Tolz.me

Unix Timestamp Converter

Convert Unix timestamps to dates and back, with automatic unit detection for seconds, milliseconds, microseconds, and nanoseconds.

Current Unix timestamp

--

Milliseconds
--
UTC
--
ISO 8601
--

This value updates every second in your browser. Timezone: your local timezone.

Enter a Unix timestamp to convert.

Getting the current timestamp in code

Math.floor(Date.now() / 1000)
JavaScript
import time int(time.time())
Python
date +%s
Bash
SELECT EXTRACT(EPOCH FROM NOW());
SQL

Timestamps stored as a signed 32-bit integer stop working after 2038-01-19T03:14:07.000Z, because the number runs out of room. Use a 64-bit value in anything you build today.

Relative times are compared against the clock in this browser. The live counter at the top of the tool is the same value you would read from your own machine.

About this tool

A Unix timestamp converter turns a number of seconds since 1970 into a date, and a date back into a number. The tool detects whether the value is in seconds, milliseconds, microseconds, or nanoseconds, then shows UTC, your local timezone, ISO 8601, and a relative phrase such as in 3 hours. A live counter gives you the current timestamp, and there are snippets for JavaScript, Python, bash, and SQL.

Browse more developer tools or explore all Tolz.me tools.

Try other relevant tools

Related articles

Frequently asked questions

What is a Unix timestamp?+

It is the number of seconds since 1 January 1970 at midnight UTC. A timestamp identifies one exact instant and carries no timezone of its own, which is why it stores and compares reliably.

How do I convert a Unix timestamp to a date?+

Paste the number into the timestamp field. The converter reads it as seconds, milliseconds, microseconds, or nanoseconds based on the number of digits, and shows the UTC time, your local time, the ISO 8601 string, and a relative phrase.

How can I tell seconds from milliseconds?+

By the number of digits. Ten digits is seconds, thirteen is milliseconds, sixteen is microseconds, and nineteen is nanoseconds. You can also pick the unit yourself from the dropdown if the automatic guess is wrong.

What is the year 2038 problem?+

A timestamp stored in a signed 32-bit integer runs out of room on 19 January 2038 at 03:14:07 UTC. The value wraps around and the system reports a date in 1901, or the program refuses to handle it. Use a 64-bit column in anything you build now.

How do I get the current Unix timestamp in code?+

In JavaScript use Math.floor(Date.now() / 1000), in Python int(time.time()), in bash date +%s, and in SQL SELECT EXTRACT(EPOCH FROM NOW()). The snippets panel in the tool copies each one.

Are Unix timestamps affected by my timezone?+

No. The number itself is the same everywhere. Timezones only change the local text shown next to it, which is why a timestamp stored in UTC reads the same for every user.

Is this unix timestamp converter free?+

Yes. It runs in your browser with no account needed, and nothing you paste is sent anywhere.

Use cases

  • Read a timestamp that came back from an API response or a log line.
  • Store a date in a database as a Unix value you can sort and compare.
  • Debug a timestamp that lands in 1970 or in the far future.
  • Copy the current timestamp into a test payload or a curl command.
  • Check whether a stored value will still work after 2038.

Unix Timestamp Converter

A Unix timestamp is a number of seconds counted from 1970-01-01 00:00:00 UTC, and it is the format most APIs, databases, and log files use for times. This converter turns one into a readable date, turns a date back into a number, and shows the same moment in UTC, in your local timezone, and in ISO 8601.

What a Unix timestamp is

The Unix epoch is the starting line. On 1 January 1970 at midnight UTC, the clock started at zero, and every second since has been counted forward. A timestamp of 1715750820 means that many seconds have passed since that moment.

The useful property is that a timestamp carries no timezone. It identifies one exact instant in time, and every system that reads it works out the local time for itself. A server in Berlin and a browser in Manila agree on what the number means, which is why timestamps are stored in databases while local date strings are not.

The second half of the job is unit detection, because the same instant can be written as seconds, milliseconds, microseconds, or nanoseconds. A number with ten digits is seconds. Thirteen digits is milliseconds. Sixteen digits is microseconds. Nineteen digits is nanoseconds. The converter guesses from the size of the number and lets you override the guess when you need to.

How to use the converter

The counter at the top shows the current Unix timestamp, updating every second. Copy it when you need a fresh value for a test payload or a log line.

For the other direction, use the two tabs. In Timestamp to date, paste a number and pick the unit if the automatic guess is wrong. You get the UTC time, the time in your browser's timezone, the ISO 8601 string, a relative phrase such as in 3 hours or 2 days ago, and the same value written back out in seconds and milliseconds.

In Date to timestamp, pick a date and time. The picker reads your local timezone, and the output shows both the local reading and the UTC value, which is the one you normally store.

Worked examples

These examples use fixed numbers so you can check the arithmetic yourself. The relative phrases depend on when you run the tool, so they are described rather than quoted.

Seconds to a date

1715750820 is a ten digit number, so it is read as seconds. The converter shows the UTC date and time, the same moment in the local timezone of the browser, and the ISO string with a Z suffix, which is the explicit marker for UTC.

Input:   1715750820
Unit:    seconds (detected)
UTC:     2024-05-15 05:27:00 UTC
ISO:     2024-05-15T05:27:00.000Z
Seconds: 1715750820
Millis:  1715750820000

Milliseconds to a date

The same moment written in milliseconds has thirteen digits. JavaScript produces this form with Date.now(), which is the usual reason a number arrives at a backend expecting seconds and lands a thousand times too large.

Input:   1715750820000
Unit:    milliseconds (detected)
UTC:     2024-05-15 05:27:00 UTC
Seconds: 1715750820
Millis:  1715750820000

A date back to a number

Pick 2024-05-15 at 09:30 in a browser running in UTC+2 and the local reading is that time, while the UTC value and the stored timestamp are two hours earlier. Storing the UTC number keeps the value stable no matter where the reading happens.

Local:   2024-05-15 09:30:00 (UTC+2)
UTC:     2024-05-15 07:30:00 UTC
Seconds: 1715758200
Millis:  1715758200000

Getting the current timestamp in code

The snippets panel in the tool has the one-liner for each language. The JavaScript version divides by 1000 and floors the result, because Date.now() returns milliseconds and most APIs want seconds. Python and Bash give seconds already. The SQL expression returns a decimal, so wrap it in a cast when the column is an integer type.

JavaScript:  Math.floor(Date.now() / 1000)
Python:      int(time.time())
Bash:        date +%s
SQL:         SELECT EXTRACT(EPOCH FROM NOW());

The 2038 problem

A signed 32-bit integer holds values up to 2147483647. Used as a count of seconds since 1970, that ceiling lands on 19 January 2038 at 03:14:07 UTC. On that moment, a system storing timestamps in that type wraps around and reports a date in 1901, or the value overflows and the program refuses to handle it.

The problem has been known for decades and it hit some systems earlier than 2038, because other limits got in the way first. A 32-bit count of milliseconds runs out in 1970 plus about 24 days, and some 16-bit and mixed-width designs ran out sooner still.

The fix is to use 64-bit values, which cover dates far beyond anything you will build. In PostgreSQL, use bigint or timestamptz. In MySQL, use bigint for the column and DATETIME for the column type. In C, the type time_t is 64-bit on current 64-bit platforms, and the databases and languages you call from are all 64-bit already. The risk sits mostly in code that stores the number in an int32, a 32-bit field in a protocol, or a JSON payload that pins the type.

The Unix Timestamp Converter stores and reports 64-bit style values throughout, so a date in 2050 converts without complaint.

Edge cases worth knowing

Timestamps before 1970 are negative numbers, and the converter reads them as dates before the epoch. The arithmetic is the same in both directions.

Leap seconds are not counted. POSIX time ignores them, so during a leap second two different UTC clock readings map to the same timestamp. At the time of writing, leap seconds have been part of UTC since 1972, and none has been added since the end of 2016.

Daylight saving time never changes a timestamp. It changes the local text you see next to it, so the same number reads as 09:00 in winter and 10:00 in summer in a timezone that shifts.

Sub-second precision is optional. A whole number of seconds is the portable choice. JavaScript Date objects work in milliseconds, which is why the millisecond form is common in browser code.

A rounded timestamp can look like an error. Values such as 1715750820.5 are legitimate, and the converter keeps the fraction when the unit allows it.

Troubleshooting a timestamp that looks wrong

If the date is off by a factor of 1000, the unit is wrong. A number that lands in 1970 or in the year 56000 has been read with the wrong divisor. Switch the unit selector to check.

If the date is off by a fixed number of hours, the timestamp is fine and the display is not. Check that the value was converted with the correct timezone rather than being treated as local time somewhere in the pipeline.

If a value in a log or API response is quoted as a string, check for a decimal point or trailing units such as 1715750820000ms. Strip them before converting.

If you need a human-readable time inside Discord, the Discord Timestamp Generator builds the tag that renders in each reader's own timezone.

This converter works entirely in your browser. Nothing you paste is sent anywhere, and the live counter is read from your own clock.

Explore more developer tools on Tolz.me.

Related tools