What the current Unix timestamp is
The number at the top of this page is how many seconds have passed since 00:00:00 UTC on 1 January 1970. It grows by one every second, and it is the same on every computer in the world that has the right time, whatever the local time zone is. The clock uses your device time, so if your device clock is wrong, the value here will be wrong as well. The milliseconds value is the same number times 1000, plus the current fraction of a second.
Milestones in Unix time
| Timestamp | Date and time (UTC) | Note |
|---|---|---|
0 | 1970-01-01 00:00:00 | The Unix epoch |
1000000000 | 2001-09-09 01:46:40 | One billion seconds |
1234567890 | 2009-02-13 23:31:30 | The "1234567890 day" |
1500000000 | 2017-07-14 02:40:00 | 1.5 billion |
1700000000 | 2023-11-14 22:13:20 | 1.7 billion |
1800000000 | 2027-01-15 08:00:00 | 1.8 billion |
2000000000 | 2033-05-18 03:33:20 | Two billion seconds |
2147483647 | 2038-01-19 03:14:07 | Largest signed 32-bit value |
The last row of the live table above counts the seconds that remain until that 32-bit limit. Systems that store time in a 64-bit integer do not have this limit. Read more in What is Unix time?
Get the current timestamp in code
| Language | Seconds | Milliseconds |
|---|---|---|
| JavaScript | Math.floor(Date.now() / 1000) | Date.now() |
| Python | int(time.time()) | int(time.time() * 1000) |
| PHP | time() | (int) (microtime(true) * 1000) |
| Java | Instant.now().getEpochSecond() | System.currentTimeMillis() |
| C# | DateTimeOffset.UtcNow.ToUnixTimeSeconds() | DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() |
| Go | time.Now().Unix() | time.Now().UnixMilli() |
| Ruby | Time.now.to_i | (Time.now.to_f * 1000).to_i |
| Rust | SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs() | .as_millis() |
| Swift | Int(Date().timeIntervalSince1970) | Int(Date().timeIntervalSince1970 * 1000) |
| Kotlin | System.currentTimeMillis() / 1000 | System.currentTimeMillis() |
| Shell | date +%s | date +%s%3N (GNU date) |
| Excel | =(NOW() - DATE(1970,1,1)) * 86400 | multiply by 86400000 |
In a database
-- MySQL
SELECT UNIX_TIMESTAMP();
-- PostgreSQL
SELECT EXTRACT(EPOCH FROM now())::bigint;
-- SQLite
SELECT strftime('%s', 'now');
-- SQL Server (DATEDIFF_BIG avoids the 2038 overflow)
SELECT DATEDIFF_BIG(SECOND, '1970-01-01', SYSUTCDATETIME());
The Excel formula uses your computer's local time, so for a true UTC result add or subtract your offset.
Why two servers can show different values
- Clock drift. Machines without time sync can be seconds or minutes off. Use NTP.
- Different units. One system shows seconds, the other milliseconds.
- Local time used by mistake. A timestamp built from local clock time, not UTC, is off by the zone offset.
- Caching. A page or API response that was cached shows an older value.
Using the current timestamp
- Token expiry. JWT
expis a Unix timestamp in seconds: now plus 3600 gives a one-hour token. Build one with the JWT claims builder. - Cache busting and versioning. A timestamp in a file name or query string.
- Logs and events. A single number that sorts correctly and has no time zone.
- Request signing. Many APIs reject requests whose timestamp differs from server time by more than a few minutes.
To turn any value into a date, use the box on this page, or the timestamp to date and date to timestamp converters. The Unix timestamp converter does both on one page.