Skip to content
Sealpaste

Delete all recent work?

This removes the 0 items saved in this browser. Your settings stay.

Stop saving recent work?

New work won't be saved in this browser. The 0 items already saved can stay or go.

Unix Timestamp Converter

Ready
Runs in your browser. Nothing you paste is uploaded unless you share it.

Convert Unix timestamps in seconds, ms, µs or ns to dates in any zone and back

Turn an epoch timestamp into a readable date in any time zone, or a date into a timestamp. Seconds, milliseconds, µs and ns are detected automatically.

How to use it

  1. Paste a timestamp; the unit is detected from its length (or pick one).
  2. Choose the time zone to read it in; your own zone is selected by default.
  3. To go the other way, type a date and time; without a zone it is read in the chosen time zone.
  4. For a column of them, choose Batch and paste one per line (up to 1,000); Copy as CSV takes the table.
  5. Below the result: the first and last second of its day, month and year, the number as a length of time, and code for it in 22 languages and tools.

Examples

Seconds

Input
1700000000
Result
UTC:        2023-11-14T22:13:20Z
Asia/Dhaka: 2023-11-15T04:13:20+06:00

Milliseconds (JavaScript Date.now())

Input
1700000000123
Result
2023-11-14T22:13:20.123Z

An LDAP or Active Directory time

Input
133724736000000000
Result
LDAP / FILETIME: 4 October 2024 at 00:00:00 UTC

18 digits are read as nanoseconds first; the Windows time is listed under “If it’s an id or a Windows time”.

A batch, one per line

Input
1728000000
1728000000123
2024-10-04T09:30:00+06:00
Result
2024-10-04T00:00:00.000Z
2024-10-04T00:00:00.123Z
2024-10-04T03:30:00.000Z

How the unit is detected

Current timestamps have a fixed number of digits per unit, so the length tells them apart. Older and later ones fit too: up to 11 digits are read as seconds, 12 to 14 as milliseconds, 15 to 17 as microseconds, and more as nanoseconds.

DigitsUnitTypical source
10secondsUnix time, JWT exp/iat, PHP time(), Python int(time.time())
13millisecondsJavaScript Date.now(), Java System.currentTimeMillis()
16microsecondsPython time.time_ns() // 1000, BigQuery UNIX_MICROS()
19nanosecondsGo time.UnixNano(), InfluxDB, OpenTelemetry

Other times it reads and writes

Besides Unix time, each result lists the same moment in the forms below. Numbers of 17 to 19 digits may also be an id or a Windows time; those readings are listed when the moment they give could be real (a snowflake from its service’s start until today, a Windows time from 1980 to 2100).

FormWhat it countsWhere you see it
ISO 8601 / RFC 3339a date and time with its offsetJSON APIs, logs, databases
RFC 2822a date with a month name and a +hhmm zoneemail Date headers, RSS
LDAP / FILETIME100-nanosecond ticks since 1 January 1601 UTCActive Directory pwdLastSet, lastLogonTimestamp; Windows files
Discord snowflakemilliseconds since 1 January 2015, in the top 42 bitsmessage, user and server IDs
X (Twitter) snowflakemilliseconds since 4 November 2010, in the top 42 bitspost and user IDs
MongoDB ObjectIdseconds since 1970, in the first 4 bytes_id fields

When a timestamp converts wrong

  • Paste the number here: the unit is detected from its size and the page says which it chose.
You seeUsual cause
A date in January 1970Seconds read as milliseconds: new Date(1710342312) in JavaScript; multiply by 1000
A year like 56168, or Python’s "year 56168 is out of range"Milliseconds read as seconds: divide by 1000
Invalid Date, or NaNPast ±8.64e15 ms, JavaScript’s limit (about year 275760), or text that isn’t a number
The right date, hours offTime zone: the number is UTC; the code printed it in local time, or the reverse
A negative numberA date before 1970, which is allowed

Get the current timestamp in code

JavaScript   Math.floor(Date.now() / 1000)
Python       int(time.time())
Go           time.Now().Unix()
PostgreSQL   SELECT extract(epoch FROM now())::bigint;
MongoDB      Math.floor(new Date().getTime() / 1000)
Bash         date +%s

Questions

What is a Unix timestamp?
The number of seconds since 1 January 1970 00:00:00 UTC (the Unix epoch), not counting leap seconds. It is the same everywhere in the world; time zones only matter when you display it.
What is the year 2038 problem?
Signed 32-bit integers hold timestamps up to 2147483647 = 19 January 2038 03:14:07 UTC. Systems that still store time in 32 bits will overflow then; 64-bit timestamps are fine for billions of years.
Why is my converted time off by some hours?
The timestamp is UTC; the hours you see depend on the time zone. Check which zone the other system shows, and remember daylight saving time changes the offset during the year.
Does it use the daylight saving rules of the date, or today’s?
The rules in force on that date, from the time zone database your browser carries. In New York, 20 March 2006 noon UTC reads 07:00 EST (UTC−5), since daylight saving then began in April, while the same day in 2007 reads 08:00 EDT under the rules from 2007.
How do I get the start and end of a day as timestamps?
Enter any moment of that day: Start and end lists the first and last Unix second of its day, month and year in the chosen time zone. A 23- or 25-hour day around a clock change comes out at its real length, and a day whose midnight is skipped starts at its first real time.
How do I get or convert Unix time in code?
Enter the timestamp and open “This timestamp to a date, in code” or “The current Unix time, in code”: JavaScript, Python, Java, Go, Rust, SQL dialects, shells, Excel and more, with the number already in place and a note where a function reads local time.
How do I convert an LDAP or Active Directory timestamp?
Paste the 18-digit number, as pwdLastSet or lastLogonTimestamp hold it. It counts 100-nanosecond ticks since 1 January 1601 UTC; the date is listed as LDAP / FILETIME. To read a whole column of them, choose Batch and the LDAP unit. Every result also gives its own LDAP value.
Can it convert many timestamps at once?
Yes: choose Batch and paste one per line, up to 1,000. Each line gets its UTC time, the time in your chosen zone and how long ago it was; a line it can’t read is named. Copy as CSV puts the table in a spreadsheet.

Related tools