5 min read
2026-02-08
Store timestamps in UTC and convert to local time only when displaying. This eliminates time zone issues.
JavaScript's Date.now() returns milliseconds (13 digits), while many server-side languages return seconds (10 digits). Confusing the two is a common source of bugs.
Sorting events by timestamp is a simple numeric comparison, which is much faster than comparing date strings.
If an API returns a timestamp, use the converter to quickly verify whether the correct date is encoded.
If your system uses 32-bit integers to store timestamps, switch to 64-bit well in advance.
1 day = 86,400 seconds
1 week = 604,800 seconds
1 month (30 days) = 2,592,000 seconds
1 year = 31,536,000 seconds
Convert timestamps with the Unix Timestamp tool.
See also: Timezone Converter, Week Number