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

Is there a reason to not just use Unix timestamps? That’s how I’ve been passing datetimes in my api and storing them in my db.


As long as you're sure they're all based on the same start time and not off by +/- 12 hours, no. One of the reasons a UTC+TZ format is useful is that it makes clients be explicit about this.

This may or may not be a problem you need to worry about in your API depending on use and clients. For example, if you're only ever sending times and not accepting them, you can just define that the epoch you return is based on UTC or locally and let clients real with it.

If you don't care about pre-epoch times, then it's a compact and fine representation for the DB, single they all have easy conversion functions to their internal formats




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: