Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Storing datetimes in fixed timezones that do not observe DST will do (but it is still not recommended), but you can't say any fixed timezone will do. Say you're storing datetimes in EST/EDT and you have a global audience. On the day the US goes back to standard time, how do you know whether 1:30AM in your database is the "first" 1:30AM or the "second" 1:30AM when you need to display the event to someone in Dubai? Are you going to store some extra metadata to indicate whether DST was in effect beside the datetime? Just store UTC.


A fixed time zone doesn't shift for DST, otherwise it wouldn't be fixed - by definition. All you need is a fixed reference point. There's nothing sacrosanct about UTC.


It wasn't clear what 'fixed' was, since that isn't normal terminology. I took 'fixed' to mean "pick a single timezone and stick to it".

If you need to pick a timezone which does not observe DST, that rules out (generally speaking) most of North America and Europe and a lot of other places. So maybe you want your new time base to be Asia/Tokyo, Asia/Shanghai, Asia/Kolkata, Europe/Moscow? You're still at the whim of governments who constantly tinker with DST -- sure Europe/Moscow is "fixed" now, but it wasn't as close as 2 years ago.

To each their own, but I would not get into the business of depending on any particular zone in tzdata staying as it is currently defined for any amount of time in the future.


I meant fixed as in unvarying. So we store our time data in EST (UTC-05:00), instead of UTC. For half the year the stored time matches the local time it's to be displayed in and so no conversion is required. The other half of the year when local time is UTC-04:00 we only need to shift the stored time by one hour to display it properly.

Many time handling libraries are extremely efficient at adding/subtracting an hour from time. This is important because we have many legacy systems using this data (think mainframe COBOL to today's latest technologies with a smattering of everything in between). So it's not just a single time handling library in use.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: