Jump to content


Change date format dynamically for each client based on clients configuration

date_format date

  • Please log in to reply
No replies to this topic

#1 marlaaragao

marlaaragao

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts

Posted 23 October 2015 - 03:58 PM

Hello,

 

This may sound dumb, but I wonder if there's a way to change the date format based on users configuration. I tried doing this on the callback_after_update of the configuration model:

$ci = &get_instance();
$ci->config->set_item('grocery_crud_date_format', $post_array['date_format'] == 'Y-m-d' ? 'sql-date' : 
                    ($post_array['date_format'] == 'd/m/Y' ? 'uk-date' : 'us-date'));

But it does no work. The date_format is always the one from the config file.

I know I can do a callback for each date field in my program, but I want to know if there's a simpler way to acomplish this. Any ideas? Thanks very much!







Also tagged with one or more of these keywords: date_format, date

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users