What "epoch" means
An epoch is the starting point from which a system counts time. In everyday developer talk, "epoch time" almost always means the Unix epoch: 00:00:00 UTC on 1 January 1970. Epoch time is the count of seconds (or milliseconds, or finer units) since then. But the Unix epoch is only one of several in use. Windows, .NET, Excel, Apple platforms and Chrome all count from different start dates, and mixing them up is a common source of dates that are off by decades.
Epochs used by common systems
| System or format | Epoch (start) | Unit | Value for Unix 1700000000 |
|---|---|---|---|
| Unix, POSIX, JavaScript, Java | 1970-01-01 | s or ms | 1700000000 |
| Windows FILETIME, Active Directory, LDAP | 1601-01-01 | 100 ns | 133444736000000000 |
| .NET DateTime ticks | 0001-01-01 | 100 ns | 638355968000000000 |
| Chrome and WebKit time | 1601-01-01 | µs | 13344473600000000 |
| Excel and Google Sheets serial date | 1899-12-30 | days | 45244.925926 |
| Apple Cocoa (Core Data, NSDate) | 2001-01-01 | s | 721692800 |
| Classic Mac OS and HFS | 1904-01-01 | s | 3782844800 |
The converter above lists all of these for any date you enter, so you can compare a value from a Windows log, a Chrome history file or a spreadsheet with a Unix timestamp.
Fixed offsets between epochs
- Windows (1601) to Unix (1970): 11,644,473,600 seconds.
- .NET (0001) to Unix: 62,135,596,800 seconds.
- Cocoa (2001) to Unix: 978,307,200 seconds.
- Classic Mac (1904) to Unix: 2,082,844,800 seconds.
- Excel serial 25569 is 1 January 1970.
To turn a FILETIME into Unix seconds, divide by 10,000,000 and subtract 11,644,473,600. To turn a Chrome timestamp (microseconds) into Unix seconds, divide by 1,000,000 and subtract the same number.
Where epoch time in each unit is used
- Seconds: POSIX
time(), JWT claims (exp,iat,nbf), Stripe, Prometheus (as a decimal), file timestamps on Unix systems. - Milliseconds: JavaScript, Java, Elasticsearch (
epoch_millis), Kafka record timestamps, many mobile and analytics SDKs. - Microseconds: Cassandra write times, Python
datetimeinternals, Chrome. - Nanoseconds: Go
UnixNano(), InfluxDB, OpenTelemetry traces.
Epoch converter in code
// Unix epoch to date (JavaScript)
new Date(1700000000 * 1000).toISOString();
// Date to Unix epoch (JavaScript)
Math.floor(Date.parse('2023-11-14T22:13:20Z') / 1000);
# FILETIME to Unix seconds (Python)
(133444736000000000 // 10_000_000) - 11644473600
// .NET ticks to Unix seconds (C#)
(ticks / 10_000_000) - 62135596800
# Cocoa time to Unix seconds
cocoa + 978307200
Epoch time and leap seconds
Unix epoch time treats every day as exactly 86,400 seconds, so leap seconds are not counted. It is a count of days times 86,400 plus the seconds into the day, not a true count of elapsed seconds. This is fine for almost all software. The Unix time guide explains what happens on a leap-second day.
See also the Unix timestamp converter, milliseconds to date and binary to decimal for working with raw values.