PrimeUtil
← Back to blog

Unix Timestamps: Seconds vs Milliseconds in Logs and APIs

2026-05-11

Avoid off-by-1000 bugs when converting epoch time, and know where your system assumes UTC vs local.

JavaScript Date often uses milliseconds since epoch; many APIs and logs use seconds—divide or multiply by 1000 deliberately.

Store and compare in UTC; display in local time for humans to avoid ambiguous “which offset?” bugs.

Leap seconds and library quirks rarely affect business apps but matter for precise astronomy or finance clocks.

When a timestamp looks wrong, check timezone, unit (s vs ms), and whether the value is start or end of an interval.

Related tools