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

The only right model of dates and times is Java Time API. This is an example of great API design that everyone must be familiar with. For example, they have different representations of time there that are context-specific. Time is not always an instant and not always require a time zone: when you specify opening hours of a shop, they are defined as a LocalTime. ZonedDateTime is not the same as Instant in the context of calculations. Adding a day to instant always adds 24 hours. Adding a day to the time in the time zone observing DST may result in adding 23 or 25 hours. Time is not hard, it’s just you always need enough context to pick the right representation.


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

Search: