A Unix timestamp is one number: the count of seconds since 1 January 1970 at 00:00:00 UTC. It is not a date, not a clock time, and not a string. It is an instant, expressed as a scalar. That simplicity is why databases, APIs and logs use it, and why so many bugs come from treating it as something else.
The epoch and the counting rule
The epoch is fixed: 1970-01-01T00:00:00Z. A timestamp of 0 is that instant. 1 is one second later. Negative values are valid and count backwards: -1 is 1969-12-31T23:59:59Z.
Unix time ignores leap seconds. Every day is treated as exactly 86,400 seconds, even when a leap second is inserted. For ordinary application timestamps this is fine; for precise astronomy or time-transfer work it is not.
Seconds versus milliseconds
| Digits | Likely unit | Example date |
|---|---|---|
| 10 | Seconds | 2023-11-14 |
| 13 | Milliseconds | 2023-11-14 |
| 16 | Microseconds | 2023-11-14 |
| 19 | Nanoseconds | 2023-11-14 |
JavaScript's Date.now() returns milliseconds. Most Unix command-line tools return seconds. Python's time.time() returns seconds as a float. Java's Instant.toEpochMilli() returns milliseconds. The mismatch is the single most common timestamp bug: a value with thirteen digits passed to a function expecting ten lands somewhere in the year 50,000.
A quick check: 1700000000 is November 2023. If your converted date is in 1970, the input was probably treated as milliseconds when it was seconds. If it is in the far future, the opposite.
A timestamp has no timezone
This is the part that surprises people. 1700000000 is the same instant everywhere on Earth. The timezone only affects how you render it. Two users in Tokyo and Los Angeles looking at the same timestamp should see different clock times and the same event.
The bug appears when a timestamp is formatted with the wrong zone, or when a wall-clock string without an offset is parsed as local time. 2026-11-18T09:00:00 is not an instant until you say which zone it is in. 2026-11-18T09:00:00Z is an instant.
Converting in practice
JavaScript:
const date = new Date(1700000000 * 1000); // seconds -> ms
console.log(date.toISOString()); // 2023-11-14T22:13:20.000Z
const seconds = Math.floor(Date.now() / 1000);
Python:
from datetime import datetime, timezone
dt = datetime.fromtimestamp(1700000000, tz=timezone.utc)
print(dt.isoformat()) # 2023-11-14T22:13:20+00:00
SQL:
SELECT to_timestamp(1700000000); -- PostgreSQL
SELECT FROM_UNIXTIME(1700000000); -- MySQL
SELECT DATEADD(second, 1700000000, '1970-01-01'); -- SQL Server
Go:
t := time.Unix(1700000000, 0).UTC()
fmt.Println(t.Format(time.RFC3339))
Storage advice
- Store instants as UTC, never as local wall-clock strings.
- Use a 64-bit integer or a timestamp type with a timezone.
- Keep the unit explicit in the column name (
created_at_ms) if you must store raw integers. - Return ISO 8601 with an offset from APIs when humans will read it.
- Do not use floating-point seconds for precise ordering; rounding can collapse distinct events.
Formatting versus storing
ISO 8601 is a display and interchange format, not a storage requirement. 2026-11-18T09:00:00+08:00 and 2026-11-18T01:00:00Z are the same instant written two ways. Both are valid. Pick one convention for logs and one for APIs, and document it.
For quick conversions, the timestamp converter accepts seconds, milliseconds and date strings, and shows the ISO form alongside local time. The milliseconds page focuses on the JavaScript unit, and the ISO 8601 page covers offsets and formatting edge cases.