Vibe Engines
YouTube

Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path

Unix Time Converter

A Unix timestamp converter. Paste an epoch value (seconds or milliseconds — auto-detected) to get the human-readable date in both UTC and your local timezone, or pick a date to get the timestamp back. Shows the ISO 8601 string, relative time, and the current epoch ticking live. Runs entirely in your browser.

Current epoch1793198025s1793198025321ms

Timestamp → date

Reading as seconds (auto)

UTC
Tue, 14 Nov 2023 22:13:20 GMT
Local
Wednesday, November 15, 2023 at 3:43:20 AM GMT+5:30
ISO 8601
2023-11-14T22:13:20.000Z
Relative
2 years ago

Date → timestamp

Epoch seconds
1699980180
Epoch milliseconds
1699980180000

Computers agree on time by counting from one agreed moment. That moment is the Unix epoch, 1970-01-01T00:00:00Z, and a Unix timestamp is the number of seconds since then. Paste one and the tool renders it four ways, pick a date and it gives the timestamp back, and a clock at the top shows the current epoch in seconds and milliseconds, updated every second.

What it computes

The input must be a whole number, negative for instants before 1970. The tool decides the unit, then builds a JavaScript Date, which counts milliseconds since the epoch:

unit          = milliseconds if 12 or more digits, else seconds
ms            = seconds × 1000, or the value itself
UTC           = HTTP-date format, e.g. Tue, 14 Nov 2023 22:13:20 GMT
ISO 8601      = YYYY-MM-DDTHH:mm:ss.sssZ, always in UTC
Local         = full date and long time, your locale and time zone
Relative      = floor(|ms − now| ÷ unit size), largest unit that fits
date → epoch  = floor(picked local time in ms ÷ 1000)

The s and ms buttons override the automatic guess. Relative time uses fixed unit sizes, a 365-day year and a 30-day month, then days, hours, minutes and seconds, and it reports only the largest whole unit. As in POSIX time, every day is exactly 86,400 seconds, so leap seconds do not exist in this arithmetic.

A worked example

The default timestamp is 1700000000.

  1. It has 10 digits, fewer than 12, so it is read as seconds: 1700000000 × 1000 = 1700000000000 ms.
  2. At 86,400 seconds a day that is 19,675 whole days after 1 January 1970, which lands on 14 November 2023, plus 80,000 seconds, which is 22:13:20.
  3. The four rows render that instant:
RowOutput
UTCTue, 14 Nov 2023 22:13:20 GMT
ISO 86012023-11-14T22:13:20.000Z
Local, New York, US EnglishTuesday, November 14, 2023 at 5:13:20 PM EST
Relative, October 20262 years ago

The local row depends on your device: the same instant is 3:43:20 AM on 15 November in India. The relative row depends on the clock: in October 2026 the gap is about 1,072 days, two whole 365-day years, and from 13 November 2026 it reads 3 years ago.

The reverse field starts at 2023-11-14T22:13, read as local time. In a UTC zone that gives 1699999980, 20 seconds before the default timestamp because the picker drops seconds. In New York, five hours behind UTC, the same wall-clock time is 1700017980.

Assumptions and limits

  • Whole numbers only. A fractional timestamp such as 1700000000.5, or one with separators, is rejected.
  • The 12-digit rule. Seconds values of 12 or more digits, after the year 5138, and millisecond values of 11 or fewer, before 3 March 1973, are misread unless you force the unit. Microsecond and nanosecond timestamps, 16 and 19 digits today, need dividing by 1,000 or 1,000,000 first.
  • No leap seconds. The 27 leap seconds added since 1972 are not counted, so the value is not an exact tally of elapsed SI seconds.
  • Range. JavaScript dates reach about 273,000 years either side of 1970; beyond that nothing is shown.
  • Local means this device. The local row and the date picker use your browser’s time zone and daylight-saving rules.

How to use the result

  • Spot the 1,000-times bug. A date in January 1970 or tens of thousands of years ahead means the value was read in the wrong unit.
  • Check token and cache expiry. JWT exp, iat and nbf claims are seconds. Paste one to see when a token expires and compare it with the live epoch.
  • Store UTC, display local. Keep the epoch value or an ISO 8601 string ending in Z in databases, logs and APIs, and convert to local time only for people.
  • Reuse the UTC row in HTTP headers. It is the date format of headers such as Last-Modified and Expires.
  • Mind 2038. A field that holds seconds in a signed 32-bit integer overflows after 2147483647, which is 2038-01-19T03:14:07Z.

When to use it, and when not

Use it when a raw number turns up and you need the instant behind it: a log line, a database column, a token claim, a cache header, a queue message. It is also the quickest way to get a timestamp for a test fixture or a query bound, by picking the date and copying the seconds.

Do not use it for calendar arithmetic. “The same time next month”, “the start of the business day in Tokyo” or “30 days after signup in the user’s zone” depend on time-zone rules and month lengths that a single number does not carry. Use a date library with named zones for that, and keep the timestamp for storing and comparing instants.

Trade-offs and limits

The conversion itself is exact. Three shortcuts around it can mislead:

ShortcutEffectExample
Fixed 30-day months, 365-day yearsRelative time is approximate and shows only the largest unit364 days ago reads “12 months ago”; 1,072 days reads “2 years ago”
Ambiguous local timesOn the night clocks go back, one wall-clock time happens twice and the picker takes the first2026-11-01 01:30 in New York gives 1793511000 (EDT); the second 01:30 is 1793514600
Skipped local timesOn the night clocks go forward, a time that never happened is moved on2026-03-08 02:30 in New York gives 1772955000, which is 03:30 EDT
Digit-count guessWrong outside about 1973 to 5138Covered in the limits above

Common mistakes

  • Comparing a JWT claim with Date.now(). exp is seconds and Date.now() is milliseconds, so exp < Date.now() is true for every token issued this century and everything looks expired. Divide by 1,000 first.
  • Parsing a date string without a zone. In JavaScript a date-only string is UTC but a date-time without an offset is local. new Date("2023-11-14") is midnight UTC, which in New York displays as 7:00 PM on 13 November.
  • Adding 86,400 for “tomorrow”. Days in local time are not always 24 hours. In New York, 1 November 2026 lasts 25 hours, so midnight plus 86,400 seconds is 23:00 the same day.
  • Truncating negative milliseconds. For −1,500 ms, Math.floor(-1500 / 1000) is −2 seconds, the correct second, while -1500 / 1000 | 0 is −1, half a second in the future. Only pre-1970 values are affected, which is why the bug survives testing.
  • Logging local time without an offset. A line stamped 01:30 on a fall-back night could be either of two instants an hour apart. Log the epoch or an ISO string ending in Z.

Check yourself

What instant is 1735689600?

Ten digits, so seconds. 1735689600 ÷ 86400 = 20089 exactly, a whole number of days with nothing left over, so the time is midnight UTC. Day 20,089 after the epoch is 1 January 2025: 2025-01-01T00:00:00.000Z.

You paste 100000000000. What does auto-detect show, and what if you force seconds?

It has 12 digits, so auto reads milliseconds: 1973-03-03T09:46:40.000Z. Forced to seconds it multiplies by 1,000 and shows 5138-11-16T09:46:40.000Z. This value is exactly the boundary of the 12-digit rule.

What does -86400 convert to?

Six digits, so seconds: exactly one day before the epoch, 1969-12-31T00:00:00.000Z. Negative timestamps are valid and count backward.

A timestamp is 364 days in the past. What does the relative row say?

364 days is less than the 365-day year, so years are skipped. In 30-day months, floor(364 ÷ 30) = 12, so it reads “12 months ago”. It switches to “1 year ago” at 365 days.

1700000000input 10 digits < 12so seconds × 1000 = ms1700000000000 12+ digits: ms as is UTC Tue, 14 Nov 2023 22:13:20 GMT ISO 2023-11-14T22:13:20.000Z Local your zone and locale Relative 2 years ago
The unit is guessed from the digit count, everything becomes milliseconds, and one instant is rendered four ways. Only the local and relative rows depend on your device and clock.

How it works

  • Auto-detects seconds vs milliseconds: 12 or more digits reads as milliseconds.
  • Renders UTC, local time, ISO 8601 and relative time ("2 years ago").
  • Converts a picked local date back to epoch seconds and milliseconds.
  • Shows the current epoch ticking live; all in-browser.

Frequently asked questions

What is a Unix timestamp?

A Unix timestamp, or epoch time, is the number of seconds that have elapsed since 1970-01-01 00:00:00 UTC, not counting leap seconds. It is a single number with no time zone attached that identifies one instant, which is why systems store and exchange time this way and convert to a local, human format only for display. For example, 1700000000 is 2023-11-14T22:13:20Z, and negative values count backward to instants before 1970.

Seconds or milliseconds: how does the tool know?

By the number of digits. A seconds timestamp for a current date has 10 digits, about 1.7 billion, while the same instant in milliseconds has 13 digits, about 1.7 trillion. The converter reads any value with 12 or more digits as milliseconds and anything shorter as seconds, and the s and ms buttons override the guess. JavaScript, Java and many web APIs use milliseconds, while Unix tools, JWT claims and most system calls use seconds, so mixing them up is a classic 1,000-times bug.

Why show both UTC and local time?

The timestamp itself is an absolute instant with no time zone. UTC is the unambiguous rendering, the one to use in logs, APIs and when comparing events across regions. Local time is what a person in your time zone experiences, offset from UTC and shifted by daylight saving time, and this tool formats it with your browser locale and zone. Seeing both side by side prevents the common mistake of reading a UTC log line as if it were local time, or the reverse.

How do I convert a date to a Unix timestamp?

Pick a date and time in the date to timestamp field and the tool shows the epoch in seconds and milliseconds. The picker reads your choice in your device time zone, so the same wall-clock time gives different timestamps in different places: 2023-11-14 22:13 is 1699999980 in a UTC zone and 1700017980 in New York, five hours behind. The picker works to the minute, so the seconds part of the result is always zero.

Do Unix timestamps count leap seconds?

No. POSIX time treats every day as exactly 86,400 seconds, so the 27 leap seconds added to UTC since 1972 are not counted, and the timestamp is slightly smaller than the true number of elapsed seconds. During a leap second, systems either repeat a timestamp or smear the extra second across many hours. JavaScript dates follow the same rule. International timekeeping bodies have decided to stop adding leap seconds by 2035, which will retire the problem.

What is the 2038 problem?

Systems that store the timestamp as a signed 32-bit integer can only count to 2,147,483,647 seconds, which is reached at 03:14:07 UTC on 19 January 2038. One second later the counter overflows to a negative number and dates wrap back to December 1901. Modern systems use 64-bit timestamps, which push the limit about 292 billion years out, but legacy 32-bit code, file formats and database columns remain a real migration concern, the same shape of bug as Y2K.