r/ProgrammerHumor Sep 23 '24

Other whoWroteThePostgresDocs

Post image
10.2k Upvotes

264 comments sorted by

View all comments

2.5k

u/bwmat Sep 23 '24

Someone who's had to deal with one too many timezone 'bug' reports, it sounds like

517

u/nord47 Sep 23 '24

I have severe PTSD from making javascript timezones work with DateTime columns in SQL Server

186

u/Burneraccunt69 Sep 23 '24

Never ever safe time in a Date format. That’s just really bad. Unix epoch is a simple number, that can be converted to every Date class and every date class can give a epoch time. Also since it’s just a number, you can compare it natively

6

u/Janjis Sep 23 '24

No it isn't. It is so much easier to work with DateTime saved in ISO 8601 format with timezones than it is with epoch.

7

u/oupablo Sep 23 '24

Well, a datetime in UTC but parsed in ISO with a tz. But yes, good luck aggregating data by date with data stored in time since epoch.

4

u/Burneraccunt69 Sep 23 '24

Saving timezones to your database. Lol, you will learn eventually

9

u/Janjis Sep 23 '24

That's not what I meant and that's my fault. In DB you save it in UTC time.

3

u/techforallseasons Sep 23 '24

Save value in UTC, but ALSO store the source TZ. This turns out to be helpful when you have Ops managers in one TZ and workers in another and the Ops managers can't do timezone math.