Remix.run Logo
reactordev 4 days ago

Ooofff. The two difficult things in software engineering, naming, and timestamps.

This hit me in the early 2000s and now everything I do is in UTC. All dates, timestamps, everything, UTC. If you want to look at a local window in time, convert the window to a utc start and end date and search. When viewing, use a js function to translate the utc date to a local one to print. The mental gymnasium of local to utc to local again…

dotancohen 4 days ago | parent | next [-]

  > The two difficult things in software engineering, naming, and timestamps.
And off-by-one errors. The two most difficult things in software engineering: naming things, timestamps, and off-by-one errors.
TheNewsIsHere 3 days ago | parent [-]

I see what you did there.

umanwizard 4 days ago | parent | prev [-]

Some times cannot be expressed in UTC.

For example: “this meeting will take place at 10 AM on July 31st, 2026, US Pacific time” cannot be expressed in UTC. You can guess what time UTC that refers to, and you’ll probably be right, but you’ll be wrong if it turns out for example that the US abolishes DST before that date.

zajio1am 3 days ago | parent [-]

In that case it is no really a time, it is a condition.

layer8 3 days ago | parent | next [-]

If the “condition” is what’s important for whatever you want to achieve, then that’s the thing to store.

Moreover, most people in real life will understand that to be a time and won’t care how it maps to UTC.

bmacho 3 days ago | parent | prev [-]

Yup, it's a function that leads to a time, depending on some things. And you can't express it in UTC, so you better store the whole function (as a string, for example). QED