Timestamp Cheatsheet

A compact reference for common timestamp formats and conversion patterns.

Common formats

  • Unix seconds: 10 digits (e.g. 1716547200)
  • Unix milliseconds: 13 digits (e.g. 1716547200000)
  • ISO 8601 UTC: 2026-05-24T06:00:00Z
  • RFC 2822: Sun, 24 May 2026 06:00:00 GMT

Examples

  • seconds to ISO: new Date(seconds * 1000).toISOString()
  • ms to seconds: Math.floor(ms / 1000)
  • ISO to seconds: Math.floor(new Date(iso).getTime() / 1000)

Common mistakes

  • Sending milliseconds to an API expecting seconds.
  • Parsing local date strings without timezone info.
  • Mixing UTC storage with local-time comparisons.

FAQ

Why use a timestamp cheatsheet?
It reduces context switching and helps teams avoid unit and timezone mistakes during development.
Does this replace full docs?
No. It is a quick operational reference, not a language-specific specification.