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
| Language | Seconds since the epoch |
|---|---|
| JavaScript | Math.floor(Date.now() / 1000) |
| Python | int(time.time()) |
| PHP | time() |
| Go | time.Now().Unix() |
| Java | Instant.now().getEpochSecond() |
| Bash | date +%s |
| PostgreSQL | extract(epoch from now()) |
| MySQL | UNIX_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.
| Language | Code | Good to know |
|---|---|---|
| JavaScript | new Date(1700000000 * 1000).toISOString() | Date takes milliseconds; toISOString gives UTC |
| Python | datetime.fromtimestamp(1700000000, tz=timezone.utc) | From the datetime module; without tz you get local time |
| PHP | gmdate('Y-m-d H:i:s', 1700000000) | UTC; date() uses the default time zone instead |
| Java | Instant.ofEpochSecond(1700000000) | From java.time; prints as ISO 8601 in UTC |
| C# | DateTimeOffset.FromUnixTimeSeconds(1700000000) | The offset is zero, so UTC |
| Go | time.Unix(1700000000, 0).UTC() | time.Unix gives local time; .UTC() converts it |
| MySQL | FROM_UNIXTIME(1700000000) | In the session time zone |
| PostgreSQL | to_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 1700000000 | BSD 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.
| Span | Seconds |
|---|---|
| Minute | 60 |
| Hour | 3,600 |
| Day | 86,400 |
| Week | 604,800 |
| 30 days | 2,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.
More tools
More on the bench
- JSON formatter and validatorPretty-print, minify and validate JSON, with the exact line of any error.
- Base64 encoder and decoderEncode text to Base64 and back, including URL-safe Base64 and emoji.
- URL encoder and decoderPercent-encode and decode URLs and query values, and break a URL into parts.
- Regex testerTest JavaScript regular expressions live, with groups, replace and common patterns.
- Text diff checkerCompare two texts or code snippets line by line or word by word.
- CSV to JSON and JSON to CSVConvert CSV to JSON and JSON to CSV, with delimiter detection.
- UUID (GUID) generatorGenerate random v4 or time-ordered v7 UUIDs, one or up to 1,000 at a time.
- JWT decoderRead the header and claims of a JSON Web Token, with expiry dates in plain English.
- MD5 and SHA hash generatorMD5, SHA-1, SHA-256, SHA-384 and SHA-512 hashes of any text, with a match check.
- Lorem Ipsum generatorPlaceholder paragraphs, sentences or words, plain or as HTML.
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.