Unix Timestamp Converter
Convert Unix epoch timestamps to dates and back.
Now:
What is a Unix timestamp?
A Unix timestamp is the number of seconds that have elapsed since 00:00:00 UTC on 1 January 1970 - a moment known as the Unix epoch. It is the standard way computers represent a point in time, because it is a single number with no time zone, no formatting and no ambiguity.
That simplicity is the whole point. Comparing two timestamps is comparing two integers. Adding a day is adding 86,400. None of the complications of calendars, zones or locales apply until you convert to a human-readable form.
Key takeaways
- A timestamp counts seconds since 1 January 1970 UTC.
- JavaScript uses milliseconds; most other systems use seconds.
- A timestamp has no time zone - it is an absolute instant.
- Leap seconds are ignored by convention.
- 32-bit signed timestamps overflow in January 2038.
Seconds or milliseconds?
This is the most common source of confusion, and the symptom is unmistakable: a date in 1970, or one about fifty thousand years in the future.
| Digits | Unit | Example | Represents |
|---|---|---|---|
| 10 | Seconds | 1789000000 | A date in 2026 |
| 13 | Milliseconds | 1789000000000 | The same moment |
| 16 | Microseconds | 1789000000000000 | Used by some databases |
| 19 | Nanoseconds | 1789000000000000000 | Go and some time-series systems |
A quick check: a current timestamp in seconds is 10 digits, and in milliseconds 13. If you get 1970, you passed milliseconds to something expecting seconds.
Date.now() returns milliseconds, while Unix tooling, most databases and most APIs use seconds. Passing a JavaScript timestamp to an API expecting seconds produces a date around the year 58,000; passing seconds where milliseconds are expected gives 1970. Both are instantly recognisable once you know to look.Useful reference values
| Timestamp | Date (UTC) | Significance |
|---|---|---|
| 0 | 1 Jan 1970 00:00:00 | The Unix epoch |
| 1000000000 | 9 Sep 2001 | One billion seconds |
| 1234567890 | 13 Feb 2009 | A sequential curiosity |
| 1500000000 | 14 Jul 2017 | |
| 2000000000 | 18 May 2033 | Two billion seconds |
| 2147483647 | 19 Jan 2038 | The 32-bit signed limit |
The year 2038 problem
Timestamps and time zones
A timestamp is an absolute instant with no zone attached. The same value converts to different wall-clock times in different places, but it refers to one moment.
| Timestamp 1789000000 | Local time |
|---|---|
| UTC | 2026-09-09 12:26:40 |
| London (BST) | 2026-09-09 13:26:40 |
| New York (EDT) | 2026-09-09 08:26:40 |
| Tokyo (JST) | 2026-09-09 21:26:40 |
One instant, five ways of writing it. This is exactly why storing timestamps rather than formatted date strings avoids so many bugs.
Leap seconds
Occasionally a leap second is added to UTC to keep it aligned with the Earth's rotation, which is gradually slowing. Unix time ignores them by definition - every day is exactly 86,400 seconds.
- This means Unix time is not strictly a count of elapsed SI seconds since the epoch.
- During a leap second, the same timestamp value is used twice or a value is skipped, depending on the implementation.
- Most systems handle this by "smearing" the extra second across a longer period.
- For almost all applications this is entirely irrelevant; for high-precision timing it is not.
Converting in code
| Language | Current timestamp | Unit |
|---|---|---|
| JavaScript | Date.now() | Milliseconds |
| JavaScript (seconds) | Math.floor(Date.now() / 1000) | Seconds |
| Python | int(time.time()) | Seconds |
| PHP | time() | Seconds |
| Java | Instant.now().getEpochSecond() | Seconds |
| Go | time.Now().Unix() | Seconds |
| SQL (Postgres) | EXTRACT(EPOCH FROM NOW()) | Seconds |
| Shell | date +%s | Seconds |
Frequently Asked Questions
What is a Unix timestamp?
The number of seconds elapsed since 00:00:00 UTC on 1 January 1970, known as the Unix epoch. It represents an absolute instant as a single number, with no time zone or formatting attached.
Why does my timestamp convert to 1970?
Because you passed a value in seconds to something expecting milliseconds, or the value is genuinely near zero. A current timestamp is 10 digits in seconds and 13 in milliseconds - checking the digit count identifies the problem immediately.
What is the difference between seconds and milliseconds?
A factor of 1,000. JavaScript's Date.now() returns milliseconds, while Unix tools, most databases and most APIs use seconds. Mixing them gives either 1970 or a date tens of thousands of years away.
Does a Unix timestamp have a time zone?
No. It is an absolute instant, always measured from UTC. The same timestamp displays as different local times around the world, but it refers to one moment. This is precisely why storing timestamps avoids so many time zone bugs.
What is the year 2038 problem?
A 32-bit signed integer can hold timestamps only up to 03:14:07 UTC on 19 January 2038, after which it overflows and wraps to December 1901. Most modern systems use 64-bit values, but embedded devices and legacy formats remain at risk.
Does Unix time account for leap seconds?
No. By definition every day is exactly 86,400 seconds, so Unix time is not strictly a count of elapsed SI seconds. Most systems smear leap seconds across a longer period. This is irrelevant for almost all applications.
How do I get the current timestamp in code?
Date.now() in JavaScript for milliseconds, or divide by 1000 for seconds. time.time() in Python, time() in PHP, time.Now().Unix() in Go, and date +%s in a shell - all of which return seconds.
Why use timestamps instead of formatted dates?
Because a timestamp is unambiguous, sorts correctly as a number, requires no parsing, and carries no time zone or locale assumptions. Formatted date strings introduce all of those problems and are a frequent source of bugs.