InfyCalculator
📅

Date to Unix Timestamp Calculator: Epoch Seconds and Milliseconds

Convert a date and time to a Unix (epoch) timestamp in seconds, milliseconds, microseconds and nanoseconds, in UTC or any time zone with daylight saving handled, with ISO 8601, RFC 2822, hex, the 2038 check and the same moment around the world.

Date
Time of day
Time zone of that date and time
UTC offset
Loading calculator…

How it works

timestamp (s) = days since 1970-01-01 × 86,400 + seconds into the day − UTC offset of the chosen zone · milliseconds = seconds × 1,000 (+ ms) · microseconds = × 10⁶ · nanoseconds = × 10⁹

A Unix timestamp counts the seconds since the Unix epoch, 00:00:00 UTC on 1 January 1970, with every day exactly 86,400 seconds long (leap seconds are ignored). To convert a date, the calculator counts whole days since the epoch, adds the seconds into the day, and, if the date and time are local to a time zone, subtracts that zone’s UTC offset on that date. Named zones use the time-zone database built into your browser, so US, European and other daylight saving rules are applied automatically, including the hour that does not exist when clocks spring forward and the hour that repeats when they fall back. You get the timestamp in seconds (Unix tools, most APIs and databases), milliseconds (JavaScript Date.now, Java), microseconds and nanoseconds, plus ISO 8601 and RFC 2822 strings, the hexadecimal value and whether it fits a signed 32-bit integer, which runs out at 03:14:07 UTC on 19 January 2038. Dates before 1970 give negative timestamps.

Worked example

Default: 15 September 2026 at 00:00 UTC. From 1970-01-01 to 2026-09-15 there are 20,711 days; 20,711 × 86,400 = 1,789,430,400 seconds, and midnight adds nothing, so the timestamp is 1789430400 (1789430400000 in milliseconds). ISO 8601: 2026-09-15T00:00:00.000Z; RFC 2822: Tue, 15 Sep 2026 00:00:00 GMT; hex 0x6AA88A80. Choosing US Eastern instead, midnight on that date is 04:00 UTC (EDT is UTC−4), so the timestamp becomes 1789444800.

Sources: Unix time — Wikipedia · EpochConverter: epoch and Unix timestamp converter

Frequently asked questions

Is the time treated as local or UTC?

UTC by default, so the answer is unambiguous. Choose a time zone (or a custom offset) if your date and time are local; the calculator subtracts that zone’s offset on that date, including daylight saving time. For example, 14:30 in New York in January (UTC−5) is 19:30 UTC.

Seconds or milliseconds: which do I need?

Unix tools, PHP, Python’s time.time() and most databases and APIs use seconds, a 10-digit number today. JavaScript’s Date.now(), Java and many logging systems use milliseconds (13 digits). Microseconds (16 digits) and nanoseconds (19 digits) appear in some databases and Go or Rust code.

What is the Year 2038 problem?

Systems that store Unix time in a signed 32-bit integer can only count up to 2,147,483,647, which is 03:14:07 UTC on 19 January 2038. One second later the value overflows. 64-bit timestamps, now standard, last for billions of years.

Can a Unix timestamp be negative?

Yes. Moments before 1 January 1970 UTC are negative: 1 January 1969 is −31,536,000. Most modern languages accept them, but some older software does not.

What happens with daylight saving time changes?

When clocks spring forward, one local hour never happens; the calculator tells you and uses the offset from just before the change. When clocks fall back, one local hour happens twice; it gives the first one and shows the second timestamp in a note.

Does Unix time count leap seconds?

No. Every Unix day is exactly 86,400 seconds, so the 27 leap seconds added to UTC since 1972 are not counted, and a timestamp converts back to the same calendar date and time.

Related calculators

This calculator is for educational purposes. Double-check important results before acting on them.