Guide
How to convert a date and time to a Unix timestamp
Convert a complete date to Unix time by choosing UTC or local time and seconds or milliseconds deliberately.
by Tools in a Tab · Published on · Reviewed on
Short answer
Converting a date and time to a timestamp requires four inputs: date, clock time, time basis, and output unit. Omitting either of the last two can produce a valid-looking number for the wrong instant.
A reliable procedure
- Enter a complete date, including the year.
- Enter the clock time; “10:00” alone has no unique date.
- Decide whether that clock time is already UTC or local to the browser.
- Choose seconds or milliseconds according to the receiving system.
- Convert, then verify the resulting UTC representation.
The Unix timestamp converter performs both directions without sending the date to a server.
Exact UTC example
Date: 2000-01-01
Time: 00:00:00.000
Basis: UTC
produces:
946684800 seconds
946684800000 milliseconds
Both values point to the same instant. The extra three zeros describe the unit, not extra information created by the conversion.
Local-time example
2026-01-15 10:00 in Madrid is not 10:00 UTC: in winter it corresponds to
09:00 UTC. The usual offset differs in summer, so applying one fixed offset
to every date of the year is unsafe.
When local time is selected, the browser applies the zone rules available on the system. A clock time skipped during a spring transition should be rejected. A time repeated during an autumn transition is ambiguous and needs more context.
Common mistakes
- Reading a UTC input as local time, or the reverse.
- Sending milliseconds to an API that expects seconds.
- Rounding away meaningful milliseconds.
- Converting a clock time without its date.
- Treating
03/04/2026as unambiguous across locales.
Use an explicit input form such as YYYY-MM-DD and document the time basis in
the application contract. If the destination is a JWT, its registered time
claims use NumericDate seconds rather than milliseconds.