GMT and time localization |
[eluser]jiggs[/eluser]
Hi! i have set my time_reference from the config file to be 'gmt', when i run the application and echo the gmt time its not showing the right answer. Code: echo date("m d Y h:i a", now()); I tried verifying this by going to some websites that generate the gmt time like http://www.timeanddate.com/worldclock/ the time on that site is using gmt and my CI is configured already to use 'gmt' yet both times shows a big difference!! How is this?
[eluser]jiggs[/eluser]
ok, anyway, i resolved the issue myself. disregard. see date("Z", now()); for more info just in case. thanks.
[eluser]jiggs[/eluser]
okay, disregard my disregard, im not sure if its just me making it more worse. i try to play around the date function to go about time localization. I guess what I'm trying to do is to make sure the user from any point around the globe see's the time on the page as a local time rather than 'server' time. in my controller i have this function below to play around: Code: function gmttolocale(){ Okay first things first, i tried to normalize my PC time and adjusted it to london time (which according to windows is just GMT without any offset) Ensuring that I get the GMT time as if Im in london. For reference this is now, 11:40 AM May 27 (again 'Im in London') Now, using the function above, testing the local time now echoes my london local time to be the same as above (11:40 AM May 27th) now() function should return the local version not gmt since config.php in CI is now set to $config['time_reference'] = 'local' the function above echoes this: Code: timezone identified: Europe/London I guess my concern would be the things below: *as per results above, the localtime returned the same as my local computers time ('I'm in London'), which is 11:30 am of May 27th which is fine... *why is there a difference to GMT in secs for 3600? when there should be no offset (Europe/London timezone specs is offset=0.0); *the last line at the bottom of the result lines should be the very line I would use to identify the user's current time (not the 'server' time) however, based on the result above the resulting time of 05 27 2008 12:30 pm makes no sense to me at all... when a user is currently in london opening my website he sees he's time to be 05 27 2008 12:30 pm instead of 05 27 2008 11:36 am ?????!! i'm pretty sure this is because of the gmdate() returning and offset of about 1 hr (3600).... But then again it cauld be other stuffs causing this... * or, i guess im just not understanding the proper use of gmdate function, date("Z", now()) function etc..?? My PC localtime is based on this http://www.timeanddate.com/worldclock/ , see london and this is using DST any help would greatly be appreciated. |
Welcome Guest, Not a member yet? Register Sign In |