What a Unix timestamp is
A Unix timestamp, also called epoch time or POSIX time, counts the seconds that have passed since midnight UTC on January 1, 1970, a moment known as the Unix epoch. The value 0 is that midnight, 86400 is exactly one day later, and 1700000000 is November 14, 2023 at 22:13:20 UTC. Dates before 1970 are simply negative numbers. Because a timestamp is a single number with no time zone attached, it is the same everywhere on Earth at the same instant, which is why servers, databases, log files and APIs use it to store time.
Unix time ignores leap seconds: every day is treated as exactly 86,400 seconds. That keeps the arithmetic simple, and it is how virtually all software, including JavaScript, handles it.
Seconds, milliseconds and microseconds
Different systems count in different units. Classic Unix tools, PHP and most SQL databases use seconds, a 10-digit number today. JavaScript’s Date.now() and Java use milliseconds, 13 digits. Some databases and languages, such as PostgreSQL internals and Python’s high-resolution clocks, use microseconds with 16 digits. Auto-detect looks at the size of the number: below 100 billion it is read as seconds, below 100 trillion as milliseconds, and larger values as microseconds or nanoseconds. If a value is ambiguous, choose the unit yourself with the buttons. Browsers store dates to the millisecond, so any finer digits are dropped when the date is displayed.
The date formats explained
- Local time uses your device’s time zone, shown in the label, and includes daylight saving time where it applies.
- UTC is Coordinated Universal Time, the reference that time zones are measured from.
- ISO 8601, such as
2023-11-14T22:13:20.000Z, is the standard for APIs, JSON and sorting. The Z means UTC. The second version shows the same instant with your local offset, like+05:30. - RFC 2822, such as
Tue, 14 Nov 2023 22:13:20 +0000, is the format used in email headers and many HTTP and RSS feeds. - Relative tells you how long ago or how far ahead the moment is.
Converting a date to a timestamp
Choose a date and time and say whether it is in your local time zone or in UTC. The same clock time gives different timestamps in different zones, so this choice matters: midnight on January 1, 2000 is 946684800 in UTC but a different number in New York or Tokyo. You can copy the result in seconds or milliseconds, along with the ISO 8601 form for checking.
A well-known limit is the year 2038 problem: systems that store seconds in a signed 32-bit integer overflow on January 19, 2038 at 03:14:07 UTC, timestamp 2147483647. Modern 64-bit systems are not affected. For related developer jobs, format API responses with the JSON formatter, decode tokens with the Base64 decoder, or create time-ordered IDs with the UUID generator.