logoalt Hacker News

skrtskrt • yesterday at 2:43 PM • 2 replies • view on HN

What’s the difference between these two other than how the client would convert to display to a user?


Replies

jasode • yesterday at 6:14 PM

The 2 different types of datetimes encode different information and is not purely a display/presentation issue, it's also storage issue.

I happen to call them "scientific datetime" vs "cultural/political datetime". However, the software dev industry has not converged on a standard vocabulary to delineate the 2 types which is unfortunate because that means programmers are unaware that the difference exists. Concepts are more top-of-mind when there are good names to label them.

If a programmer doesn't understand how the 2 datetimes behave differently, they will create software bugs as I've outlined before: https://news.ycombinator.com/item?id=39418897

There's the meme of "store UTC everywhere" (maybe perceived as correct because of superficial similarity to "use UTF-8 everywhere") ... but storing datetimes as UTC is only unambiguous for historical events such as timestamps of activity stored in server logs.

But future datetimes can have ambiguous edge cases which causes the split into 2 different types.

➕ show 1 reply
pseidemann • yesterday at 3:29 PM

It's not only about display. If you store a user's appointment only as a UTC timestamp, you actually can't know the hour of the day (and the day itself to be precise) on which this appointment should happen, for a given calendar (probably the user's calendar, in a specific non-UTC timezone). You would have to guess by using the calendar's/user's timezone and compute some offset with UTC. But what if the user changes timezones or the timezone itself changes its value? Store without a timezone, and you know the exact hour and day the user intended. One is pointing to a day and hour in a calendar, the other is pointing at a point on the line of a linear timeline.

➕ show 1 reply