Current Unix Epoch Time
—
— ms
GMT / UTC
—
ISO 8601
—
Your Local Time
—
—
Epoch → Human Date
| Input interpreted as | ||
| ISO 8601 (UTC) | ||
| GMT / UTC | ||
| Your local time | ||
| Relative |
Human Date → Epoch
Interpret input as:
| Epoch (seconds) | ||
| Epoch (milliseconds) | ||
| ISO 8601 (UTC) | ||
| GMT / UTC |
Seconds → Duration
| Human readable | |
| Days | |
| Hours | |
| Minutes |
Get current epoch timestamp — code snippets
JavaScript
Math.floor(Date.now() / 1000) // seconds
Date.now() // milliseconds
Python
import time
int(time.time()) # seconds
time.time_ns() // 1_000_000 # milliseconds
Bash / Shell
date +%s # seconds
date +%s%3N # milliseconds (GNU date)
Go
import "time"
time.Now().Unix() // seconds
time.Now().UnixMilli() // milliseconds
Java
System.currentTimeMillis() / 1000L // seconds
System.currentTimeMillis() // milliseconds
Instant.now().getEpochSecond() // Java 8+
PHP
time() // seconds
round(microtime(true) * 1000) // milliseconds
PostgreSQL
EXTRACT(EPOCH FROM NOW())::bigint
-- or
SELECT FLOOR(EXTRACT(EPOCH FROM NOW()));
MySQL
SELECT UNIX_TIMESTAMP();
SELECT UNIX_TIMESTAMP(NOW());
Ruby
Time.now.to_i # seconds
Time.now.to_f.round(3) # milliseconds
Rust
use std::time::{SystemTime, UNIX_EPOCH};
SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap().as_secs() // seconds
C#
DateTimeOffset.UtcNow.ToUnixTimeSeconds() // seconds
DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() // ms
Swift
Int(Date().timeIntervalSince1970) // seconds
Int(Date().timeIntervalSince1970 * 1000) // ms
Quick reference — common durations in seconds
| Duration | Seconds |
|---|---|
| 1 minute | 60 |
| 1 hour | 3,600 |
| 1 day | 86,400 |
| 1 week | 604,800 |
| 30 days | 2,592,000 |
| 1 year (365 days) | 31,536,000 |
Notable epoch timestamps
| Epoch (seconds) | Date (UTC) | Significance |
|---|---|---|
| 0 | 1970-01-01 00:00:00 | The Unix epoch |
| 1,000,000,000 | 2001-09-09 01:46:40 | 1 billion seconds |
| 1,234,567,890 | 2009-02-13 23:31:30 | Widely celebrated milestone |
| 1,500,000,000 | 2017-07-14 02:40:00 | 1.5 billion seconds |
| 2,000,000,000 | 2033-05-18 03:33:20 | 2 billion seconds |
| 2,147,483,647 | 2038-01-19 03:14:07 | 32-bit signed int max (Y2K38) |
Full guide: What is Unix Time, the Y2038 problem, and more →