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

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.



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?




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: