I'm finishing up a personal command line script project I started a few days ago to build an automatic comprehensive backup system for my computer (after all, hard drives do fail).
I was wondering, though, is there any point in adapting the system so it works in different time zones? How does one go about doing that, especially my bigger project I'm going to be moving into MySQL and I don't have much knowledge about how they handle time in different time zones and etc. Anyone have any good primer docs on this? Any suggestions?
Coding for different Time Zones
Moderator: General Moderators
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
it's pretty simple to just use gmt, as the times are most often in reference to the server anyways. If you want to base things off the user logged in, then using their machine's time (via Javascript) can be done, however, the server's time is often more trustable.. so offering a personal timezone setting can help you offset the server's (GMT) time to theirs..
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
I write my code to always use GMT, as that's fairly simple for the server to determine, and if the server is moved, the code will still work as is. The server itself will have a "local" time setting which it uses to offset the time it finds when the server's time needs to be referenced (for whatever reason).. the user has a seperate timezone setting whereby all times are adjusted to when doing visual calculations..