Unix Timestamp Converter

Convert a timestamp or a date

UTC
—
Your time zone
—
Relative
—
Date and time in UTC
Time zone

Unix time

Seconds
—
Milliseconds
—
Microseconds
—
Nanoseconds
—

Date formats in UTC

ISO 8601
—
RFC 3339
—
RFC 2822
—

Current Unix time

—
Milliseconds
—
UTC
—

Compare UTC with other time zones

Start and end in UTC

Enter a timestamp or a date to see where its day, month and year start and end.

Current Unix time in code

Get the current Unix time in seconds, and in milliseconds where the language has a standard call.

JavaScript

Math.floor(Date.now() / 1000) // seconds
Date.now() // milliseconds

Python

import time

int(time.time())  # seconds
time.time_ns() // 1_000_000  # milliseconds

Go

import "time"

time.Now().Unix()      // seconds
time.Now().UnixMilli() // milliseconds (Go 1.17+)

Java

import java.time.Instant;

Instant.now().getEpochSecond(); // seconds
Instant.now().toEpochMilli();   // milliseconds

PHP

time();                         // seconds
(int) (microtime(true) * 1000); // milliseconds

SQL

-- PostgreSQL (floor, because a cast to bigint rounds)
SELECT floor(extract(epoch FROM now()))::bigint;
-- MySQL and MariaDB
SELECT UNIX_TIMESTAMP();
-- SQLite 3.38 or later
SELECT unixepoch();
-- SQL Server 2016 or later
SELECT DATEDIFF_BIG(SECOND, '1970-01-01', SYSUTCDATETIME());

Shell

date +%s    # seconds (Linux, macOS, BSD)
date +%s%3N # milliseconds (GNU date on Linux; not macOS)

What is Unix time?

Unix time, also called epoch time or POSIX time, counts the seconds since 00:00:00 UTC on January 1, 1970, the Unix epoch. At any moment it is the same number everywhere in the world; time zones only change how that moment is written as a local date and time.

Seconds, milliseconds, microseconds and nanoseconds

Many systems count smaller units: JavaScript and Java use milliseconds, and some databases and logs use microseconds or nanoseconds. Auto-detect reads a value as the unit that puts it within about 3,000 years of 1970: up to 11 digits as seconds, 12 to 14 digits as milliseconds, 15 to 17 as microseconds, and 18 or more as nanoseconds. Choose a unit to read it differently.

Negative timestamps

Moments before the epoch have negative Unix times. For example, −1 is 23:59:59 UTC on December 31, 1969.

Leap seconds

Unix time doesn't count leap seconds: every day is exactly 86,400 seconds long. When a leap second happens, Unix time repeats a second instead of adding one.

The year 2038 problem

Systems that store Unix time as a signed 32-bit integer run out after 2,147,483,647 seconds, at 03:14:07 UTC on January 19, 2038. One second later the value wraps to −2,147,483,648, which reads as December 13, 1901. A 64-bit timestamp lasts for billions of years.

Time zones and daylight saving time

Local dates and times use the IANA Time Zone Database, version 2026e, including historical offsets and daylight saving time rules. When clocks spring forward, a skipped local time moves forward by the length of the gap; when they fall back, you choose which of the two times you mean. To compare UTC with several places at once, use the UTC time converter. See data sources for details.