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
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.
Run it yourself
Executing the snippet below in Node.js v26.12.1 printed the comments under each line. Small Tools Unix Timestamp Converter shows UTC: 2025-01-01T00:00:00.000Z for both 1735689600 and 1735689600000, because values below 1,000,000,000,000 are read as seconds. The value 999999999999 is read as seconds and gives +033658-09-27T01:46:39.000Z, while 1000000000000 is read as milliseconds and gives 2001-09-09T01:46:40.000Z.
Epoch Time Converter returns Epoch seconds: 1735689600 for 2025-01-01T00:00:00Z. The same text without the Z is read in your device's timezone, so it returned 1735657200 on a device set to Japan Standard Time. The same ambiguity appears in the JavaScript example for three timezones.
new Date(1735689600 * 1000).toISOString()
// 2025-01-01T00:00:00.000Z
new Date(1735689600).toISOString() // seconds mistaken for milliseconds
// 1970-01-21T02:08:09.600Z
Math.floor(Date.UTC(2025, 0, 1) / 1000)
// 1735689600
new Date("2025-01-01T00:00:00").toISOString() // no offset: read as local time
// TZ=UTC: 2025-01-01T00:00:00.000Z
// TZ=Asia/Tokyo: 2024-12-31T15:00:00.000Z
// TZ=America/New_York: 2025-01-01T05:00:00.000Z
new Date(8.64e15).toISOString()
// +275760-09-13T00:00:00.000Z
new Date(8.64e15 + 1).toISOString()
// RangeError: Invalid time valueWhat this guide does not verify
- Leap seconds. POSIX defines seconds since the Epoch as an approximation and leaves the relationship to the actual time of day unspecified, so this guide does not model how systems handle them.
- Time zone database rules and daylight-saving transitions for specific regions. The example uses three fixed zones.
- Systems that store timestamps in 32-bit integers or in other units such as microseconds, nanoseconds or days.
- Clock accuracy and skew between machines.
Frequently asked questions
Why did my date land in January 1970? A value in seconds was treated as milliseconds. new Date(1735689600) is 1970-01-21T02:08:09.600Z, so multiply by 1000 before you pass seconds to Date.
Why does the same ISO text give different epoch values on two computers? A date-time without Z or an offset is read in the local timezone. Add Z or an explicit offset such as +09:00 when the value must mean one instant.
What is the largest date JavaScript can represent? 8.64e15 milliseconds after the epoch, which is +275760-09-13T00:00:00.000Z. One millisecond more gives Invalid Date.
Related tools
- Unix Timestamp Converter — Convert Unix timestamps in seconds or milliseconds to readable dates.
- Epoch Time Converter — Convert a date and time into Unix epoch seconds and milliseconds.
- ISO 8601 Converter — Normalize date strings to ISO 8601 and inspect their UTC timestamp.
- Timezone Converter — View a date and time in another timezone without leaving your browser.
- JWT Expiration Checker — Read a JWT exp claim and compare it with the current time.