Welcome Guest, Not a member yet? Register   Sign In
Time Localization: CI + Javascript
#1

[eluser]insub2[/eluser]
I'm starting this *right now* and wanted to get some feedback or start a discussion on the topic.

So, my plan in a nutshell:

Convert all timestamps to GMT on database insert.
Then, use Javascript ( getTimezoneOffset() ) to get an offset for converting times upon retrieval.

Any thoughts? Suggestions?

...I'll post code as soon as I write it.
#2

[eluser]bretticus[/eluser]
Depends on what you are doing. If the users login, you can just store their offset (make them choose timezone on register or use javascript and sessions to record their current offset.) If you want them to go straight to the listing page, for example, you can still use the "session trick" by forcing a redirect that initially uses javascript to record the users time offset and store it in a session (tack it onto the URL so you'd have a javascript redirect and then a header redirect.) The idea is that it's probably better to do the adjustment server-side than manipulate the DOM once the page loads. Sounds fun. Good luck!




Theme © iAndrew 2016 - Forum software by © MyBB