Unix Timestamp Tools

Current Unix Time
// 01 โ€” Epoch โ†’ Human-readable date

Supports seconds (10 digits), milliseconds (13), microseconds (16), nanoseconds (19) โ€” auto-detected

Invalid timestamp. Please enter a numeric Unix timestamp.
โ€”
โ€”
โ€”
โ€”
โ€”
โ€”
// 02 โ€” Date โ†’ Epoch timestamp
โ€”
โ€”
โ€”
โ€”
Please check the values โ€” year (1970โ€“9999), month (1โ€“12), day (1โ€“31), hour (0โ€“23), min/sec (0โ€“59).

Or paste a date string:

Could not parse that date string.
// 03 โ€” Epoch range for year / month / day
โ€”
โ€”
โ€”
โ€”
// 04 โ€” Convert seconds to years, months, days, hours, minutes

86400 = 1 day  ยท  604800 = 1 week  ยท  2629800 = ~1 month  ยท  31536000 = 1 year

// 05 โ€” Batch timestamp conversion

One timestamp per line. Paste from logs, databases, or APIs.


  

What is a Unix timestamp?

A Unix timestamp โ€” also called epoch time, POSIX time, or Unix time โ€” is a single integer representing the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC. This reference point is known as the Unix Epoch, and it was chosen by early Unix developers at Bell Labs as a convenient starting point close to when the operating system was being built.

The fundamental advantage of Unix timestamps is that they are completely timezone-independent. The integer 1700000000 means exactly one thing โ€” November 14, 2023 at 22:13:20 UTC โ€” regardless of whether you're reading it in Oslo, Tokyo, or New York. There's no ambiguity, no daylight saving time to account for, and no locale-specific formatting to parse. It's just a number.

You'll encounter Unix timestamps in almost every layer of modern software: REST API responses (fields like created_at, expires_at, last_modified), SQL database columns typed as INTEGER or BIGINT, JWT tokens (the iat and exp claims), server log files, file system metadata, Git commits, Kafka messages, AWS Lambda events, Stripe payments, and GitHub webhook payloads. Understanding how to read and convert them is a core skill for any developer or system administrator.

Seconds, milliseconds, microseconds โ€” how to tell them apart

The single most common source of confusion with Unix timestamps is precision. Not all timestamps count seconds โ€” JavaScript and Java default to milliseconds, PostgreSQL stores microseconds internally, and Go can produce nanosecond timestamps. If you paste a timestamp into a converter and get a date in 1970 or far in the future, the precision is wrong. This converter auto-detects based on digit count.

10 digits = seconds

The standard Unix format. Example: 1700000000. Used by Python's time.time(), PHP's time(), Go's time.Now().Unix(), Ruby's Time.now.to_i, C's time(NULL), MySQL's UNIX_TIMESTAMP(), and Bash's date +%s.

13 digits = milliseconds

JavaScript's default. Example: 1700000000000. Returned by Date.now(), new Date().getTime(), Java's System.currentTimeMillis(), and most browser APIs. Divide by 1000 to get seconds.

16 digits = microseconds

Used in PostgreSQL's internal timestamptz storage, some Linux kernel interfaces, and Python's time.time_ns() / 1000. Example: 1700000000000000. Divide by 1,000,000 to get seconds.

19 digits = nanoseconds

Used in Go's time.Now().UnixNano(), Rust's SystemTime::now(), and high-frequency trading systems. Example: 1700000000000000000. Divide by 1,000,000,000 to get seconds.

A quick rule of thumb: if your timestamp shows a date in 1970, you're treating milliseconds as seconds. If it shows a date far in the future (like 2527), you're treating seconds as milliseconds. Fix it by multiplying or dividing by 1000.

Get the current Unix timestamp in any language

The live timestamp at the top of this page shows the current Unix time โ€” updated every second. Here's how to get the same value in code:

JavaScript / Node.js

Math.floor(Date.now() / 1000)
In milliseconds: Date.now()

Python

import time
int(time.time())
In ms: int(time.time() * 1000)

PHP

time()
With microseconds: microtime(true)

Go

time.Now().Unix()
In ms: time.Now().UnixMilli()

Java / Kotlin

Instant.now().getEpochSecond()
In ms: System.currentTimeMillis()

Ruby

Time.now.to_i
In ms: Time.now.to_f * 1000

Rust

SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap().as_secs()

C# / .NET

DateTimeOffset.UtcNow
.ToUnixTimeSeconds()

MySQL

SELECT UNIX_TIMESTAMP();

PostgreSQL

SELECT EXTRACT(EPOCH FROM NOW())::INT;

SQLite

SELECT unixepoch('now');
or strftime('%s','now')

Bash / Shell

date +%s
In ms: date +%s%3N

Convert Unix timestamp to date โ€” code examples

Converting a Unix timestamp to a human-readable date requires knowing the precision (seconds vs milliseconds) and the target timezone. Here are the most reliable patterns in each major language:

JavaScript

// Seconds timestamp
new Date(ts * 1000).toISOString()

// Milliseconds timestamp
new Date(ts).toISOString()

// With timezone
new Intl.DateTimeFormat('en-GB',
{ timeZone: 'Europe/Oslo' })
.format(new Date(ts * 1000))

Python

from datetime import datetime, timezone

# UTC (recommended)
datetime.fromtimestamp(ts,
tz=timezone.utc)

# Format as string
datetime.utcfromtimestamp(ts)
.strftime('%Y-%m-%d %H:%M:%S')

PHP

// UTC
gmdate('Y-m-d H:i:s', $ts)

// Local
date('Y-m-d H:i:s', $ts)

// With timezone
$dt = new DateTime("@$ts");
$dt->setTimezone(
new DateTimeZone('Europe/Oslo'));

MySQL

-- Basic
SELECT FROM_UNIXTIME(1700000000);

-- Formatted
SELECT FROM_UNIXTIME(ts,
'%Y-%m-%d %H:%i:%s');

-- Date to Unix
SELECT UNIX_TIMESTAMP(
'2026-04-17 10:35:00');

PostgreSQL

-- Unix to datetime
SELECT TO_TIMESTAMP(1700000000);

-- With timezone
SELECT TO_TIMESTAMP(ts)
AT TIME ZONE 'Europe/Oslo';

-- Datetime to Unix
SELECT EXTRACT(EPOCH FROM NOW());

Go

t := time.Unix(ts, 0).UTC()

// Format
t.Format(time.RFC3339)

// With timezone
loc, _ := time.LoadLocation(
"Europe/Oslo")
t.In(loc).Format("2006-01-02")

Unix time and timezones

Unix timestamps are always stored as UTC. The timezone only matters when you display the timestamp to a human. The same integer looks different depending on where you are: 1700000000 is 22:13:20 UTC, but 23:13:20 CET (Oslo in winter) and 17:13:20 EST (New York). The underlying value never changes โ€” only the presentation does.

This is why it's best practice to always store timestamps as UTC Unix integers in your database and only convert to local time at the display layer. Mixing timezones in storage leads to subtle bugs that are difficult to track down, especially around daylight saving time transitions.

Common timezone pitfalls: forgetting that JavaScript's new Date() parses strings without a timezone offset as local time, not UTC. Always append a Z to ISO strings (2026-04-17T10:35:00Z) to force UTC parsing. In Python, use timezone-aware datetimes (datetime.now(timezone.utc)) instead of the naive datetime.now() which uses local time.

Useful Unix timestamp reference values

Milestone timestamps

0 = Jan 1, 1970 (the epoch)
1000000000 = Sep 9, 2001
1234567890 = Feb 13, 2009
1500000000 = Jul 14, 2017
1700000000 = Nov 14, 2023
2000000000 = May 18, 2033
2147483647 = Jan 19, 2038 (32-bit max)

Common durations in seconds

1 minute = 60
1 hour = 3,600
1 day = 86,400
1 week = 604,800
1 month โ‰ˆ 2,629,800
1 year = 31,536,000
10 years = 315,360,000

Time arithmetic examples

7 days ago: now - 604800
30 days from now: now + 2592000
Start of today (UTC): round down to nearest 86400
JWT expires in 1h: now + 3600
Session timeout 24h: now + 86400

The Year 2038 problem

32-bit signed integers max out at 2,147,483,647 = Jan 19, 2038. Systems storing timestamps as INT32 will overflow. Modern systems use 64-bit integers, extending the range to the year ~292 billion. All new code should use 64-bit types.

ISO 8601 and Unix timestamps

ISO 8601 is the international standard for representing dates and times as strings: 2026-04-17T10:35:00Z. The T separates the date from the time, and Z means UTC (you can also use a numeric offset like +02:00). ISO 8601 is used in JSON APIs, HTML <time> elements, HTTP headers, and log formats.

The relationship between ISO 8601 and Unix timestamps: they represent the same information in different forms. 2026-04-17T10:35:00Z and 1776415200 are the same moment โ€” one is human-readable, the other is machine-efficient. Unix timestamps are better for storage and arithmetic; ISO 8601 strings are better for display and interoperability.

Parse an ISO 8601 string to Unix in JavaScript: Math.floor(new Date('2026-04-17T10:35:00Z').getTime() / 1000). In Python: int(datetime.fromisoformat('2026-04-17T10:35:00+00:00').timestamp()). The date string parser in section 2 above accepts ISO 8601 directly โ€” just paste it in.

Related tools on this site

Frequently asked questions

Copied!