counter101
EN

Epoch Converter

Paste a Unix timestamp to read it as a date in UTC, your own time and any other time zone, or pick a date to get its epoch time in seconds and milliseconds.

How to use the epoch converter

The top card shows the current Unix time, ticking in seconds, with the milliseconds under it. Copy seconds and Copy milliseconds put it on your clipboard, and Convert now loads it into the converter.

Every conversion you confirm (press Enter, leave the box or copy a result) goes into Recent conversions below the tool: the last 50, saved in this browser only. Tap one to load it again. Share link sends the current input to someone else. Nothing you type is sent anywhere: all the parsing happens in your browser.

To see what time it is in other cities, use the time zone converter. To count days to a date, use the days until calculator. For day-of-year codes and astronomical day numbers, there is the Julian date converter.

What epoch time is

Unix time, also called epoch time or POSIX time, counts the seconds since the Unix epoch: 00:00:00 UTC on January 1, 1970. The timestamp 0 is that moment, 86400 is the start of January 2, 1970, and -1 is the last second of 1969. It is the same number everywhere in the world at the same instant; a time zone only changes how the number is shown as a date.

Many systems count in smaller units. JavaScript and Java usually use milliseconds (13 digits for dates between 2001 and 2286), some databases and logs use microseconds (16 digits), and some languages and tracing tools use nanoseconds (19 digits). Nanosecond values are larger than the biggest whole number a JavaScript number holds exactly, so this timestamp converter handles them as text and keeps every digit.

Unix time does not count leap seconds. Every day is exactly 86,400 seconds long in Unix time, as POSIX defines it, so a timestamp maps to a UTC date with simple arithmetic. The converter uses the Gregorian calendar for all dates, extended backward before 1582, and astronomical year numbering, where year 0 is 1 BC.

The year 2038 problem

Systems that store Unix time in a signed 32-bit integer can count up to 2,147,483,647 seconds. That timestamp is 2038-01-19 03:14:07 UTC; one second later the number no longer fits and wraps around to a date in December 1901 (-2,147,483,648 is 1901-12-13 20:45:52 UTC). Software that stores time in 64 bits does not have this limit. Type 2147483647 into the converter to see the date for yourself.

Get the current epoch time in code

LanguageSecondsMilliseconds
JavaScriptMath.floor(Date.now() / 1000)Date.now()
Pythonint(time.time())time.time_ns() // 1000000
PHPtime()(int) floor(microtime(true) * 1000)
JavaInstant.now().getEpochSecond()System.currentTimeMillis()
Gotime.Now().Unix()time.Now().UnixMilli()
C#DateTimeOffset.UtcNow.ToUnixTimeSeconds()DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
RubyTime.now.to_i(Time.now.to_f * 1000).to_i
Bashdate +%s
MySQLSELECT UNIX_TIMESTAMP();
PostgreSQLSELECT EXTRACT(EPOCH FROM now());

Python needs import time first and Java import java.time.Instant;. PostgreSQL returns seconds with a fraction. To go the other way in JavaScript, new Date(seconds * 1000).toISOString() gives the UTC date.

Keyboard shortcuts

Shortcuts work when the cursor is not in a text box; press Esc to leave a box first.

Questions

How do I know if a timestamp is in seconds or milliseconds?

Count the digits. For dates between September 2001 and November 2286, a timestamp in seconds has 10 digits and one in milliseconds has 13. The converter picks the unit this way and tells you which one it used; if the date looks wrong, pick another unit.

Can Unix time be negative?

Yes. A negative timestamp is a moment before January 1, 1970, UTC. For example -86400 is 00:00:00 UTC on December 31, 1969. Type the minus sign in front of the number.

Does a Unix timestamp depend on the time zone?

No. The count is the same everywhere at the same moment, because it is measured from midnight UTC on January 1, 1970. The time zone only matters when you turn it into a date and a clock time, which is why the converter shows UTC, your local time and a zone of your choice side by side.

How do I convert a date to a Unix timestamp?

Open Date to timestamp, pick the date and time, and choose whether they are UTC, your local time or another time zone. The answer appears in seconds and in milliseconds, ready to copy.

Is anything I paste sent to a server?

No. The epoch converter runs entirely in your browser. Your inputs and the recent conversions list are saved in this browser only, and a share link carries the input in the link itself.

More in Dates and time

Put this epoch converter on your website

Free for classrooms, clubs, blogs and shops: paste this code into any page. It works the same inside your site, and counts stay in each visitor's own browser. For a dark version, add ?theme=dark after /epoch-converter/ in the code.