Need to turn a Unix timestamp into a date, or a calendar time into epoch seconds? Convert above in your browser — seconds or milliseconds, UTC or local, then copy ISO 8601. This unix timestamp converter is part of the programming tools on TechOpt.io, next to the UUID generator.
How this unix timestamp converter tells seconds from milliseconds
A Unix timestamp is usually the number of seconds since 00:00:00 UTC on 1 January 1970 (the Unix epoch; see Unix time). JavaScript’s Date.now(), Java’s System.currentTimeMillis(), and many databases store milliseconds instead. A current value in seconds is about 10 digits; the same instant in milliseconds is about 13. This converter treats values of 1012 or larger as milliseconds unless you pick a unit.
UTC vs local time
Unix time is defined in UTC. Local time is UTC plus your browser’s offset, including daylight saving. The same epoch second is a different wall-clock reading in New York than in Tokyo. When you convert a date to a timestamp, choose Local if the picker should match your clock, or UTC if the date is already in UTC.
The Year 2038 problem
On 19 January 2038 at 03:14:07 UTC, a signed 32-bit Unix time overflows. Systems that still store time_t as a 32-bit integer wrap to a negative value. 64-bit time_t (the default on modern 64-bit Linux) is fine for billions of years. This page uses JavaScript’s Date, which is 64-bit milliseconds, so 2038 is not a limit here.
Get a Unix timestamp in code
The converter above is for a quick copy. In a shell or application, use the standard library:
date +%s # seconds
date +%s%3N # milliseconds (GNU date)
Math.floor(Date.now() / 1000) // seconds
Date.now() // milliseconds
import time
print(int(time.time())) # seconds
print(time.time_ns() // 1_000_000) # milliseconds
echo time(); // seconds
echo (int) (microtime(true) * 1000); // milliseconds
FAQ
What is a Unix timestamp?
A Unix timestamp (also called epoch time) is the number of seconds that have elapsed since 00:00:00 UTC on 1 January 1970, not counting leap seconds. 0 is that instant. Negative values are earlier. Most Linux tools and APIs use seconds; JavaScript Date.now() uses milliseconds.
Seconds or milliseconds — how do I tell them apart?
A current timestamp in seconds is about 10 digits (around 1.7 billion). The same instant in milliseconds is about 13 digits (around 1.7 trillion). This converter treats values of 1e12 or larger as milliseconds unless you pick a unit. JavaScript, Java, and many databases store milliseconds; PHP time(), Python time.time() (truncated), and date +%s use seconds.
What is the difference between UTC and local time?
UTC is the time zone Unix timestamps are defined in. Local time is UTC plus your browser’s offset (and DST). The same epoch second is a different clock reading in New York than in Tokyo. When you convert a date to a timestamp, choose Local if the picker should match your wall clock, or UTC if the date is already in UTC.
What is the Year 2038 problem?
On 19 January 2038 at 03:14:07 UTC, a signed 32-bit Unix time overflows. Systems that still store time_t as a 32-bit integer wrap to a negative value. 64-bit time_t (the default on modern 64-bit Linux) is fine. This converter uses JavaScript’s Date, which is 64-bit milliseconds, so 2038 is not a limit here.
Does this timestamp converter upload my values?
No. It runs entirely in your browser. Timestamps and dates never leave your machine.
How do I get the current Unix time in code?
On Linux, date +%s prints seconds. In JavaScript, Date.now() is milliseconds (Math.floor(Date.now() / 1000) for seconds). Python: import time; time.time(). PHP: time().
Looking for more developer how-tos? Browse the programming guides or the rest of the tools.