global date format - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: global date format (/showthread.php?tid=26821) |
global date format - El Forum - 01-24-2010 [eluser]peter222[/eluser] I there any way to set global date format (dd-mm-YYYY) that comes from MySQL database? It is not comfortable to use php date() function in all application places. I want to user can set it in preferences how data is displayed in all aplication. How to do it? global date format - El Forum - 01-24-2010 [eluser]pistolPete[/eluser] If you want to use a user specific date format, store the format string in the session's userdata. Retrieve the string wherever you need to display a date and pass it to PHP's date() function or one of the Date Helper functions. global date format - El Forum - 01-24-2010 [eluser]peter222[/eluser] Thank You for help. Finally I have done it this way: set constans: Code: define('DATEFORMAT','d-m-YYYY'); and wrote dth_helper: Code: if ( ! function_exists('dth')) |