Small Tools

Date & Time · Developer Guide

Unix Timestamps Explained

If a date unexpectedly lands in 1970 or thousands of years ahead, check the unit before debugging the timezone. Keep the original value and its documented unit together.

What is a Unix timestamp?

An epoch value expresses elapsed time relative to 1970-01-01T00:00:00Z. APIs commonly use seconds, while JavaScript Date uses milliseconds. The number does not itself identify a local timezone.

How to choose the correct conversion

  • Read the API or database documentation for the unit. Contemporary second values often have ten digits and millisecond values thirteen, but digit count is a clue rather than a universal rule.
  • Use Unix Timestamp Converter for a numeric value and Epoch Time Converter for a date string.
  • Use an ISO date with Z or an explicit offset when exchanging a time between environments.
  • Compare the UTC output first, then use the local display or Timezone Converter for presentation.

Example: one instant in two units

Equivalent values
Seconds:      1735689600
Milliseconds: 1735689600000
UTC:          2025-01-01T00:00:00.000Z

JavaScript:
new Date(1735689600 * 1000).toISOString()

Common mistakes

  • Passing seconds directly to new Date: JavaScript interprets them as milliseconds.
  • Appending Z to a local time without conversion: that changes its meaning to UTC.
  • Comparing a JWT exp value with Date.now without dividing milliseconds by 1000.
  • Using an ambiguous date such as 01/02/2025: use an ISO string with an explicit timezone instead.

Automatic unit detection and its limits

The current numeric converter interprets absolute values below 1,000,000,000,000 as seconds and larger values as milliseconds. This works for common contemporary dates, but it misclassifies some historical millisecond values near the epoch and extreme second values. For those inputs, convert the documented unit explicitly in application code rather than relying on detection.

Epoch output rounds seconds down to a whole second. The local line depends on your device timezone; UTC output identifies the same instant consistently across machines.

Practical use cases

When correlating service logs, normalize timestamps to UTC and preserve fractional seconds where available. For a token expiry investigation, compare the documented seconds claim against the current epoch seconds and the server's clock tolerance. Browser-only conversion does not upload your timestamps.

Related tools

References

Browse all developer guides →