Unix timestamp converter

The current Unix time, taken from our atomic-referenced clock rather than your device, and a converter between timestamps and dates in any time zone.

Unix time now, seconds1793123290
Milliseconds1793123290000

 

Timestamp to date

Date to timestamp

The Year 2038 problem

Systems that store Unix time as a signed 32-bit number can count only up to 2,147,483,647 seconds. That moment is 19 January 2038, 03:14:07 UTC; one second later the number overflows and jumps to 13 December 1901. Most modern systems use 64 bits and are safe, but embedded devices, old file formats and databases may not be.

 

What Unix time is

Unix time counts the seconds since 1 January 1970, 00:00:00 UTC, called the Unix epoch. It is the same everywhere in the world at the same moment, which is why programs use it to store and compare times. Time zones only matter when a timestamp is shown to a person.

It ignores leap seconds. Every Unix day has exactly 86,400 seconds, even the 27 days that had a leap second. During a leap second, Unix time repeats or stretches a second, depending on the system. This is also why some large companies smear leap seconds over many hours.

Seconds or milliseconds? Unix and most databases use seconds; JavaScript and Java use milliseconds; some systems use microseconds or nanoseconds. A current timestamp has 10 digits in seconds, 13 in milliseconds, 16 in microseconds and 19 in nanoseconds, which is how this converter recognises the unit.

Getting the current timestamp

LanguageSecondsMilliseconds
Shell (Linux, macOS)date +%sdate +%s%3N (GNU date)
JavaScriptMath.floor(Date.now() / 1000)Date.now()
Pythonint(time.time())time.time_ns() // 1_000_000
PHPtime()(int) floor(microtime(true) * 1000)
JavaInstant.now().getEpochSecond()System.currentTimeMillis()
C#DateTimeOffset.UtcNow.ToUnixTimeSeconds()DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
Gotime.Now().Unix()time.Now().UnixMilli()
PostgreSQLEXTRACT(EPOCH FROM now())EXTRACT(EPOCH FROM now()) * 1000
MySQLUNIX_TIMESTAMP()UNIX_TIMESTAMP(NOW(3)) * 1000

All of these read the computer’s own clock, so they are only as accurate as its synchronisation. To keep servers right, use NTP with good sources: see our European NTP server list and its configuration generator.