![]() |
date helper - converting time AUTO detecting DST - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: date helper - converting time AUTO detecting DST (/showthread.php?tid=58644) |
date helper - converting time AUTO detecting DST - El Forum - 07-02-2013 [eluser]SPeed_FANat1c[/eluser] I don't know why is this not done, but this would be good. I googled and finally found the solution. Code: public function convert_time_auto_dst($system_time, $to_timezone = 'UTC') { $system_time is the in format which we are using in our application, storing in database. $to_timezone - is the codeigniter timezone short like UP1, but I have not made full convertion function to php time zones. You can adjust this to require as parameter PHP time zone. And I return formated time but this also can be adjusted. Simple function but good, we dont need to manually update daylight saving parameter in database for users. Unlless there are some bugs. |