Skip to content

Unix timestamp (epoch) converter

Convert epoch timestamps to readable dates and dates to timestamps, in UTC or any time zone. ISO 8601 dates work too.

Current Unix timestamp

–

Dates below are shown and read in this time zone.

Timestamp to date

Seconds, milliseconds, microseconds, nanoseconds or an ISO 8601 date

Date to timestamp

Read in your time zone

Code

Getting the current timestamp

LanguageSeconds since the epoch
JavaScriptMath.floor(Date.now() / 1000)
Pythonint(time.time())
PHPtime()
Gotime.Now().Unix()
JavaInstant.now().getEpochSecond()
Bashdate +%s
PostgreSQLextract(epoch from now())
MySQLUNIX_TIMESTAMP()

Timestamp to date in code

How to turn 1700000000 into a date in the languages and tools developers use most. Most of them count in seconds; JavaScript counts in milliseconds.

LanguageCodeGood to know
JavaScriptnew Date(1700000000 * 1000).toISOString()Date takes milliseconds; toISOString gives UTC
Pythondatetime.fromtimestamp(1700000000, tz=timezone.utc)From the datetime module; without tz you get local time
PHPgmdate('Y-m-d H:i:s', 1700000000)UTC; date() uses the default time zone instead
JavaInstant.ofEpochSecond(1700000000)From java.time; prints as ISO 8601 in UTC
C#DateTimeOffset.FromUnixTimeSeconds(1700000000)The offset is zero, so UTC
Gotime.Unix(1700000000, 0).UTC()time.Unix gives local time; .UTC() converts it
MySQLFROM_UNIXTIME(1700000000)In the session time zone
PostgreSQLto_timestamp(1700000000)Gives a timestamp with time zone
Excel, Google Sheets=A1/86400 + DATE(1970,1,1)Format the cell as a date; the result is UTC
Google Sheets=EPOCHTODATE(A1)Seconds by default; the result is UTC
Linux (GNU date)date -u -d @1700000000-d reads @seconds; -u shows UTC
macOS (BSD date)date -u -r 1700000000BSD date uses -r for seconds instead

Seconds in a minute, hour, day and year

Handy for expiry times, cache lifetimes and adding days to a timestamp.

SpanSeconds
Minute60
Hour3,600
Day86,400
Week604,800
30 days2,592,000
Year (365 days)31,536,000
Leap year (366 days)31,622,400

Timestamps and time zones

A timestamp marks one instant, the same everywhere. Time zones only matter when you turn it into a date and time for people to read: 1700000000 is 14 November 2023, 22:13:20 in UTC, but already 15 November in Tokyo. Store timestamps (or UTC times), and convert to local time only for display.

Storing timestamps in 32-bit fields? Read the year 2038 problem first; it also lists the maximum date of a 64-bit timestamp in seconds, milliseconds and nanoseconds.

Frequently asked questions

What is a Unix timestamp?

The number of seconds since 1 January 1970 at 00:00:00 UTC, a moment called the Unix epoch. It is the same everywhere in the world at a given instant, which makes it a simple, time-zone-free way for computers to store and compare times.

Is it in seconds or milliseconds?

Unix itself counts seconds, but JavaScript’s Date.now() and many Java and web APIs use milliseconds. A current timestamp in seconds has 10 digits; in milliseconds it has 13. This converter detects the unit from the number of digits.

Can I convert an ISO 8601 date to a timestamp?

Yes. Paste a date such as 2024-03-10T12:00:00Z into the timestamp field and the converter shows it as Unix seconds and milliseconds. A date without Z or an offset like +01:00 is read in the time zone you picked.

What is the year 2038 problem?

Systems that store Unix time as a signed 32-bit number run out on 19 January 2038 at 03:14:07 UTC, when the count passes 2,147,483,647 and wraps around to a date in 1901. Modern systems use 64-bit numbers, which last for billions of years.

Does Unix time include leap seconds?

No. Unix time pretends every day has exactly 86,400 seconds, so the leap seconds added to UTC over the years are not counted. For everyday dates, this makes no visible difference.