Hacker News new | ask | show | jobs
by pg_1234 1594 days ago
Often it is first and foremost a type casting issue.

Whether you are comparing a date to a datetime or saving a date as a datetime, almost every language turns '2022-01-02' into something like '2022-01-02T00:00:00+0000' i.e. the first second of the day.

In practice it is usually safer to convert to '2022-01-02T12:00:00+0000', centering the time in the day and minimizing the chance that timezone related or other errors will move you into a whole new day.

The time component is always a lie, but noon is the safest lie.

1 comments

That seems to be completely counter to the point I was trying to make. It's nothing to do with type casting - you need to consider the intent of the human being who created that data. What did they mean?