A Unix timestamp is the number of seconds that have passed since 00:00:00 UTC on January 1, 1970, a moment called the Unix epoch. For example, 1700000000 means November 14, 2023, at 22:13:20 UTC. To convert one, use a timestamp converter, the Linux command date -d @1700000000, or a single line of code.
You’ll find these numbers in log files, database columns, API responses and token expiry fields. This guide covers what they mean, how to convert them in both directions on Linux, macOS and in common languages, and the mistakes that cause most timestamp bugs.
Try it: Timestamp ConverterConvert Unix epoch timestamps (seconds or milliseconds) to human-readable dates in any time zone, and dates back to timestamps.
Open tool — freeWhat is a Unix timestamp?
A Unix timestamp (also called epoch time or POSIX time) is a single integer that identifies one instant. Zero is the epoch itself, positive numbers are after it, and negative numbers are before it, so -86400 is December 31, 1969.
- It’s the same everywhere. The number doesn’t depend on where the server or user is.
- It’s easy to calculate with. Subtract two timestamps and you get a duration in seconds. Sorting them is just sorting numbers.
- It ignores leap seconds. Every Unix day is exactly 86,400 seconds, which is what almost every application wants.
Most Unix tools and many APIs use seconds. JavaScript and Java use milliseconds, which add three digits. If you’re not sure which one you’re looking at, our guide to Unix time in seconds vs milliseconds explains how to tell them apart and convert between them.
Do Unix timestamps have a time zone?
No. The zone matters only when you turn it into a date for a person: the same timestamp is 22:13 in London in November and 17:13 in New York, and both are correct.
When an API or file needs a readable format, use ISO 8601 with an explicit offset, such as 2023-11-14T22:13:20Z (the Z means UTC) or 2023-11-14T17:13:20-05:00. A string without an offset is ambiguous, so avoid it for anything that marks a specific moment.
For future local events, such as a meeting at 9am next July, store the local time plus the zone name (America/New_York), not only a timestamp. Daylight saving rules can change before the event happens.
Unix timestamp reference table
These values are handy for sanity-checking a conversion or writing an expiry time without a calculator.
| Timestamp (seconds) | Date and time (UTC) | Why it’s useful |
|---|---|---|
0 | 1970-01-01 00:00:00 | The epoch; a date showing 1970 usually means a zero or a unit mix-up |
1000000000 | 2001-09-09 01:46:40 | First 10-digit timestamp |
1700000000 | 2023-11-14 22:13:20 | A recent round number for testing |
1767225600 | 2026-01-01 00:00:00 | Start of 2026 |
2000000000 | 2033-05-18 03:33:20 | Next round milestone |
2147483647 | 2038-01-19 03:14:07 | Largest signed 32-bit value (the 2038 limit) |
| Duration | Seconds |
|---|---|
| 1 minute | 60 |
| 1 hour | 3,600 |
| 1 day | 86,400 |
| 1 week | 604,800 |
| 30 days | 2,592,000 |
| 365 days | 31,536,000 |
How to use a timestamp converter
For one-off checks, such as reading a log line or confirming when a cache entry expires, an online timestamp converter is faster than writing code. Our free timestamp converter handles seconds and milliseconds, shows the result in any time zone and converts dates back to timestamps. It runs entirely in your browser.
- Paste the timestamp into the converter.
- Confirm whether it’s seconds (10 digits for current dates) or milliseconds (13 digits).
- Choose the time zone you want to read it in, or keep UTC when comparing against server logs.
- Check that the year makes sense before you trust the result.
- To go the other way, enter a date, time and zone, then copy the timestamp it produces.
Linux time converter: the date command
On Linux, the GNU date command is a built-in timestamp converter. The @ prefix tells it the input is a Unix timestamp, and +%s prints one.
# Current Unix timestamp
date +%s
# Timestamp to date (local time, then UTC)
date -d @1700000000
date -u -d @1700000000
# Timestamp to ISO 8601
date -u -d @1700000000 --iso-8601=seconds
# Date to timestamp
date -d "2024-01-01 00:00:00 UTC" +%smacOS ships the BSD version of date, which uses different flags:
# Timestamp to date
date -r 1700000000
date -u -r 1700000000
# Date to timestamp (interpreted as UTC)
date -j -u -f "%Y-%m-%d %H:%M:%S" "2024-01-01 00:00:00" +%sBoth “date to timestamp” examples print 1704067200. Leave out the UTC part and the date is read in your machine’s local zone, which gives a different number.
How do you convert time to a Unix timestamp in code?
Every mainstream language can convert a date to a Unix timestamp and back. The key is to be explicit about UTC, because a date string without an offset is usually read as local time.
JavaScript
// Current timestamp in seconds
Math.floor(Date.now() / 1000);
// Date to timestamp
Math.floor(Date.parse("2024-01-01T00:00:00Z") / 1000); // 1704067200
// Timestamp to date
new Date(1700000000 * 1000).toISOString(); // "2023-11-14T22:13:20.000Z"Python
import time
from datetime import datetime, timezone
int(time.time()) # current timestamp
int(datetime(2024, 1, 1, tzinfo=timezone.utc).timestamp()) # 1704067200
datetime.fromtimestamp(1700000000, tz=timezone.utc) # 2023-11-14 22:13:20+00:00PHP and SQL
// PHP
time();
strtotime("2024-01-01 00:00:00 UTC"); // 1704067200
gmdate("Y-m-d H:i:s", 1700000000); // 2023-11-14 22:13:20
-- MySQL
SELECT UNIX_TIMESTAMP(), FROM_UNIXTIME(1700000000);
-- PostgreSQL
SELECT EXTRACT(EPOCH FROM now()), to_timestamp(1700000000);In a spreadsheet, =A1/86400+DATE(1970,1,1) turns a seconds timestamp in A1 into a date. Format the cell as a date and time, and remember the result is UTC.
Common timestamp bugs
- Unit mismatch. Name fields clearly, for example
created_at_ms. - Storing local time as if it were UTC. Store UTC and convert at display time.
- Parsing dates without an offset. The same string produces different timestamps on servers in different zones.
- Adding 86,400 seconds to move one calendar day. Days with a daylight saving change have 23 or 25 local hours, so use a date library when local time matters.
- Timestamps stored as strings or floats. Strings of different lengths sort wrongly and floats lose precision. Keep integers.
Timestamps also appear inside JWTs, where the exp and iat claims are Unix seconds. A JWT inspector decodes the token and shows the expiry as a readable date, which saves converting it by hand.
What is the year 2038 problem?
Older systems often stored Unix time as a signed 32-bit integer. The largest value that fits is 2147483647, or 03:14:07 UTC on January 19, 2038. One second later it overflows to a negative number that reads as December 1901.
Modern operating systems and languages use 64-bit time, so the risk sits in leftovers: embedded devices and firmware, database columns or file formats defined as 32-bit integers, and calculations of future dates (a 15-year expiry, say) that already cross 2038. For any new schema, use a 64-bit integer or a native timestamp type.
The practical takeaway
Store instants as UTC timestamps (or ISO 8601 with an offset), know whether you’re working in seconds or milliseconds, and convert to local time only when showing dates to people. Keep date -d @TIMESTAMP and date +%s in your head for the terminal, and when a converted date looks absurd, check the unit first.
Frequently asked questions
How do I get the current Unix timestamp?
On Linux or macOS run date +%s in a terminal. In JavaScript use Math.floor(Date.now() / 1000), and in Python use int(time.time()). All three return whole seconds since the epoch.
Do Unix timestamps have a time zone?
No. A Unix timestamp counts time since 1970-01-01 00:00:00 UTC, so it refers to the same instant everywhere. Time zones only matter when you display it as a local date and time.
How do I know if a timestamp is in seconds or milliseconds?
For current dates, a timestamp in seconds has 10 digits and one in milliseconds has 13. If a conversion lands in 1970 or thousands of years in the future, you have mixed up the units.
What is the year 2038 problem?
Systems that store Unix time as a signed 32-bit integer run out of room at 03:14:07 UTC on January 19, 2038, and the value wraps to a date in 1901. Modern 64-bit systems are not affected, but old firmware and database columns can be.



