Topic

Unix timestamps, dates, and time zones

Convert dates and timestamps deliberately and avoid unit, UTC, range, and leap-second errors.

A Unix timestamp represents an instant as a numeric distance from the epoch. Errors appear when an application confuses seconds with milliseconds, applies a time zone twice, or tries to store the value in a type that is too small.

Quick verification path

  1. Identify whether the number uses seconds or milliseconds.
  2. Convert it and display the UTC date first.
  3. Apply a local time zone only when presenting the instant to a person.
  4. Check the range of the destination language, database, or protocol.
  5. Keep a known example around the epoch for integration tests.

An instant is not its representation

1970-01-01T00:00:00Z is a textual representation of the instant whose timestamp is 0. A local date without a zone does not necessarily identify one instant: it may be missing or repeated during a daylight-saving transition.

Choose the input format

  • A numeric timestamp: open timestamp to date and select seconds or milliseconds. The tool does not infer the unit.
  • A manual date and time: open date to timestamp and select UTC or this browser’s local time. Manual input has whole-second precision.
  • An ISO 8601 string: choose “Paste ISO 8601 with time zone” in date mode. The written Z or offset determines the instant; the manual time-zone choice does not apply. Up to three fractional digits are preserved.

For example, 2000-01-01T01:00:00.123+01:00 produces 946684800123 milliseconds. The result shows both seconds and milliseconds, plus UTC and local representations. See the ISO 8601 conversion example for the exact workflow and accepted format.

The guides below also cover negative values, the 32-bit limit, leap seconds and JWT time claims, separating format mistakes from limits in the receiving system.

Tools

Tools for this topic

Guides

Guides in a recommended order

  1. What is a Unix timestamp and how is it calculated?Understand what Unix time measures, where its epoch starts, and how elapsed seconds map to an exact UTC date.
  2. How to convert a date and time to a Unix timestampConvert a complete date to Unix time by choosing UTC or local time and seconds or milliseconds deliberately.
  3. Unix timestamp seconds vs millisecondsDistinguish 10-digit and 13-digit timestamps, convert units without moving the instant, and diagnose implausible dates.
  4. Unix timestamps, UTC, and local timeSeparate an absolute UTC instant from its local representation and avoid time-zone and daylight-saving errors.
  5. ISO 8601 vs Unix timestamp: differences and usesCompare ISO 8601 date-time text with Unix timestamps, including offsets, precision, and equivalent representations of one instant.
  6. Negative Unix timestamps and dates before 1970Learn what a negative Unix timestamp means, how pre-epoch dates are calculated, and which storage limits to check.
  7. Year 2038 problem: what happens to 32-bit Unix timestampsUnderstand the 2147483647 limit, the 2038 overflow date, and how to check whether a system still uses signed 32-bit time.
  8. Unix timestamps and leap seconds: what the counter really measuresUnderstand why Unix time does not count leap seconds as separate instants and how that affects conversions and durations.
  9. JWT exp, iat, and nbf time claims explainedConvert and distinguish the exp, iat, and nbf claims in a JWT without confusing decoding with security validation.

Reviewed on by Tools in a Tab.