Timezone Display |
[eluser]Demonicpagan[/eluser]
I'm working with an application written using the CI platform and I'm working on writing a modification for it. The problem I'm having is dealing with timezones. My PHP setting uses America/Chicago. For CI I have $config['time_reference'] = 'gmt'; when I use now() in my code having it use UM6 for the CI timezone setting, DST off, the time displays an hour than what it is supposed to be (2:03 AM CST instead of 1:03 AM CST - I live in the same TZ as what the server is). What would be the cause of this? Using time() instead of now() I have a 5 hour difference (showing 8:03 PM CST instead of 1:03 AM CST at the time of this writing) in the time. I'm using the gmt_to_local() function in my code. Any assistance as to what is going on will be greatly appreciated.
[eluser]WanWizard[/eluser]
Time and timezone support in CI is a disaster. Get yourself PHP 5.2+, and use the DateTime classes of PHP for proper timezone support.
[eluser]Demonicpagan[/eluser]
I am running PHP 5.3 so with that, I'll see what I can write up. Hopefully I can write something that works properly.
[eluser]WanWizard[/eluser]
See http://php.net/manual/en/book.datetime.php. Just use it like any other static class. |
Welcome Guest, Not a member yet? Register Sign In |