jsondecode.com logo

Unix Timestamp Converter

Convert Unix timestamps to human-readable dates and vice versa. Auto-detects seconds vs milliseconds. Runs entirely in your browser.

Timestamp → Date

Date → Timestamp

Accepts: ISO 8601 (2024-01-15T12:00:00Z), RFC 2822, or any format JavaScript's Date can parse.

What is a Unix Timestamp?

A Unix timestamp (also called Unix time, epoch time, or POSIX time) is the number of seconds elapsed since 00:00:00 UTC on 1 January 1970 — the Unix epoch. It is a timezone-independent, language-agnostic standard for representing a precise instant in time. Unix timestamps appear in databases, REST APIs, JWT tokens, file system metadata, log files, and system clocks.

Many modern systems use millisecond timestamps — the number of milliseconds since the epoch. JavaScript's Date.now(), for example, returns milliseconds. This converter auto-detects: values greater than 10¹² are treated as milliseconds; smaller values are treated as seconds.

Notable Unix timestamps

TimestampDate (UTC)Note
01970-01-01 00:00:00Unix epoch — time zero
10000000002001-09-09 01:46:40Billionth second milestone
11111111112005-03-18 01:58:31All-ones pattern
12345678902009-02-13 23:31:30Popular milestone celebrated globally
17000000002023-11-14 22:13:20Recent reference point
20000000002033-05-18 03:33:20Two-billionth second
21474836472038-01-19 03:14:07Y2K38 — max 32-bit signed integer
42949672952106-02-07 06:28:15Max 32-bit unsigned integer

Get the current Unix timestamp in any language

JavaScript / Node.jsMath.floor(Date.now() / 1000)
Pythonimport time; int(time.time())
Gotime.Now().Unix()
PHPtime()
RubyTime.now.to_i
JavaInstant.now().getEpochSecond()
RustSystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs()
C#DateTimeOffset.UtcNow.ToUnixTimeSeconds()
Bashdate +%s
SQL (PostgreSQL)EXTRACT(EPOCH FROM NOW())::BIGINT

Seconds vs milliseconds vs microseconds

UnitDigits (2024)Common in
Seconds10 digits (~1.7B)Unix/POSIX, PHP time(), JWT exp claim
Milliseconds13 digits (~1.7T)JavaScript Date.now(), Java System.currentTimeMillis()
Microseconds16 digitsPostgreSQL, Python time.time_ns()//1000, high-res logs
Nanoseconds19 digitsGo time.Now().UnixNano(), Rust SystemTime

Unix timestamp vs ISO 8601

ISO 8601 (e.g., 2024-04-18T12:00:00Z) is human-readable and includes timezone information explicitly. Unix timestamps are always UTC and are simpler to compare and store as integers. APIs often accept both — ISO 8601 in request bodies, Unix timestamps in query parameters. When storing in a database, a Unix timestamp integer is faster to index and compare than a string date.

The Year 2038 problem

On 19 January 2038 at 03:14:07 UTC, 32-bit signed integers used to store Unix timestamps will overflow, rolling back to 1901-12-13. This is similar to the Y2K problem. Modern 64-bit systems are not affected — a 64-bit Unix timestamp can represent dates billions of years in the future. Legacy embedded systems, databases with 32-bit DATETIME columns, and old C code using time_t as a 32-bit type are at risk.

Frequently asked questions

How do I convert a Unix timestamp to a date in Python?

Use datetime.datetime.fromtimestamp(ts, tz=datetime.timezone.utc) for UTC or fromtimestamp(ts) for local time. For millisecond timestamps, divide by 1000 first: datetime.datetime.fromtimestamp(ts / 1000, tz=datetime.timezone.utc).

How do I convert a Unix timestamp to a date in JavaScript?

Pass the timestamp in milliseconds to the Date constructor: new Date(ts * 1000) for second timestamps, or new Date(ts) for millisecond timestamps. Then use .toUTCString(), .toISOString(), or .toLocaleString() to format.

What is the difference between Unix time and UTC?

UTC is a timezone — a standard for civil timekeeping. Unix time is a count of seconds since a fixed epoch, measured in UTC. Unix time does not account for leap seconds, so it is technically not identical to UTC, but the difference is negligible for most applications.

Why does my timestamp show 1970-01-01?

A value of 0 (or near 0) converts to the epoch date. This usually means the timestamp was not set — a field defaulted to 0 or null was coerced to a number. Check whether the source system populates the timestamp correctly.

How do I store a Unix timestamp in a database?

Use a BIGINT column for maximum compatibility and portability. PostgreSQL also has TIMESTAMPTZ which stores UTC internally. Avoid VARCHAR for timestamps — integer comparison is faster and avoids format mismatch bugs.

What is epoch time?

Epoch time and Unix time are synonymous. 'Epoch' refers to the reference point (1 January 1970 00:00:00 UTC) from which the count begins. Some systems use different epochs — Windows FILETIME counts 100-nanosecond intervals since 1601-01-01, for example.

If jsondecode.com saved you time, share it with your team

Free forever. No ads. No sign-up. Help other developers find it.