Epoch & Unix Timestamp Conversion Utilities
The current Unix epoch time isLoading...
Loading...
Convert Date Format into a Readable Timestamp
Convert Logs with Timestamps
Paste logs to convert timestamps into readable dates.
SpreadSheet Converter
A | B | C | |
---|---|---|---|
1 | |||
2 | |||
3 | |||
4 |
Converted Data (Read-Only)
A | B | C | |
---|---|---|---|
1 | |||
2 | |||
3 | |||
4 |
Timestamps are automatically converted below.
What is Epoch?
The Epoch time is the current time measured in the number of seconds since the Unix Epoch. Epoch 0 is January 1, 1970, 00:00:00 GMT (ISO 8601: 1970-01-01T00:00:00Z). Leap seconds are not used in Unix time.
Normal Time | Seconds |
---|---|
1 minute | 60 seconds |
1 hour | 3600 seconds |
1 day | 86400 seconds |
1 week | 604800 seconds |
1 month (30.44 days) | 2629743 seconds |
1 year (365.24 days) | 31556926 seconds |
Programming with Epoch
The Unix Epoch time can be retrieved in various programming languages using built-in functions. Below is a reference for obtaining the current Unix timestamp in different environments.
Language | Command | Documentation |
---|---|---|
Bash (Linux/Unix) | date +%s | man date |
C | time(NULL) | C Reference |
C# | (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds | C# Docs |
C++ | std::time(nullptr) | C++ Reference |
ClickHouse | SELECT toUnixTimestamp(now()); | ClickHouse Docs |
Dart (Flutter) | DateTime.now().millisecondsSinceEpoch ~/ 1000 | Dart Docs |
Firebase Firestore | Timestamp.now().seconds | Firestore Docs |
Go | time.Now().Unix() | Go Docs |
Haskell | import Data.Time.Clock.POSIX; getPOSIXTime | Haskell Docs |
Lua | os.time() | Lua Docs |
Python | import time; time.time() | Python Docs |
R | as.numeric(Sys.time()) | R Docs |
Rust | SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs() | Rust Docs |
Swift | Date().timeIntervalSince1970 | Swift Docs |
TypeScript | Math.floor(Date.now() / 1000) | TypeScript Docs |
Convert from Epoch to Human-Readable Date
Convert an Epoch timestamp into a human-readable date using various programming languages. The examples below all show how to convert the epoch timestamp `1698402600` (which represents 2023-10-27 10:30:00 UTC).
Language | Code Example | Documentation |
---|---|---|
Bash (Linux/Unix) | date -d @1698402600 | man date |
C | Use localtime() to convert to struct tm, then strftime() to format. | C Reference (localtime, strftime) |
C# | DateTimeOffset.FromUnixTimeSeconds(1698402600).UtcDateTime.ToString() | C# Docs (DateTimeOffset.FromUnixTimeSeconds) |
C++ | Use std::localtime() to convert to std::tm, then std::strftime() to format. | C++ Reference (localtime, strftime) |
ClickHouse | SELECT toDateTime(1698402600) | ClickHouse Docs |
Dart (Flutter) | DateTime.fromMillisecondsSinceEpoch(1698402600 * 1000, isUtc: true) | Dart Docs |
Go | time.Unix(1698402600, 0).UTC() | Go Docs (time.Unix) |
Java | Instant.ofEpochSecond(1698402600).atZone(ZoneOffset.UTC) | Java Docs (Instant.ofEpochSecond) |
JavaScript | new Date(1698402600 * 1000) | MDN Web Docs (Date) |
Lua | os.date("%Y-%m-%d %H:%M:%S", 1698402600) | Lua Docs (os.date) |
PHP | date('Y-m-d H:i:s', 1698402600) | PHP Docs (date) |
Python | datetime.datetime.utcfromtimestamp(1698402600) | Python Docs (datetime.utcfromtimestamp) |
R | as.POSIXct(1698402600, origin='1970-01-01', tz='UTC') | R Docs (as.POSIXct) |
Ruby | Time.at(1698402600).utc | Ruby Docs (Time.at) |
Rust | Use the chrono crate: NaiveDateTime::from_timestamp_opt(). | Rust Docs (chrono::NaiveDateTime) |
Swift | Date(timeIntervalSince1970: 1698402600) | Swift Docs (Date) |
TypeScript | new Date(1698402600 * 1000) | TypeScript/JavaScript Docs (Date) |