Unix Timestamps Explained: Convert Seconds to a Readable Date
Open almost any database or API and you will meet numbers like 1700000000. That is a Unix timestamp. It is just the number of seconds since 1 January 1970 at 00:00 UTC, a moment called the Unix epoch.
Why use a number for time?
Dates are messy. Time zones, daylight saving, different date styles like 10/11 versus 11/10. A single number has none of these problems. It is the same everywhere, easy to compare, and easy to store. To find which event came first, you just see which number is smaller.
Seconds or milliseconds?
This causes many bugs. Some systems count seconds (10 digits today), while JavaScript counts milliseconds (13 digits). If your date shows up as 1970, you probably used seconds where milliseconds were expected. If it shows a year far in the future, you did the opposite.
Converting in JavaScript
new Date(1700000000 * 1000).toISOString() // "2023-11-14T22:13:20.000Z" Math.floor(Date.now() / 1000) // current timestamp
UTC and local time
A timestamp does not belong to any time zone. The same moment looks different on a clock in Mumbai and in London. Store timestamps or UTC dates, and convert to local time only when showing them to a user.
The year 2038
Older systems keep timestamps in a 32-bit number, which runs out in January 2038. Modern systems use 64 bits, so it is mostly a problem for old software.
Handy facts
- One day is 86,400 seconds.
- One hour is 3,600 seconds.
- Timestamps ignore leap seconds.
Convert one now
Open the Unix Timestamp tool on our Developer Converters page. Paste a timestamp, in seconds or milliseconds, and see the date in UTC, in your own time zone, and as a friendly "3 days ago". You can also type a date and get the number back. The "Use current time" button fills in right now.
Frequently asked questions
How do I know if a timestamp is in seconds or milliseconds?
Count the digits. A current timestamp in seconds has 10 digits, such as 1761300000. In milliseconds it has 13 digits. If you treat milliseconds as seconds you get a date tens of thousands of years in the future.
Does a Unix timestamp include a time zone?
No. It is always the number of seconds since 1 January 1970 in UTC. The time zone only matters when you turn it into a readable date, so the same timestamp shows a different clock time in India (UTC+5:30) and London.
What happens in 2038?
Systems that store the timestamp as a signed 32-bit number run out of room on 19 January 2038. Modern systems use 64-bit numbers, which last for billions of years, but old devices and databases may need updating.
How do I get the current timestamp?
In JavaScript use Math.floor(Date.now() / 1000) for seconds. In Python use int(time.time()). In MySQL use UNIX_TIMESTAMP(). Our timestamp converter also shows the current value.
Open the free Developer Converters. It runs in your browser, so nothing is uploaded.