Stamp amser Unix cyfredol (amser epoch)
Trawsnewidydd stamp amser Unix
Convert epoch time to a human-readable date, or a date to a Unix timestamp. Seconds and milliseconds are detected automatically.
Stamp amser → Dyddiad
Dyddiad → Stamp amser
Beth yw stamp amser Unix?
A Unix timestamp (also called epoch time, POSIX time, or Unix time) is the number of seconds that have elapsed since 00:00:00 UTC on January 1, 1970 — a moment known as the Unix epoch. It counts every day as exactly 86,400 seconds and ignores leap seconds.
Because it is a single integer with no time zone, no daylight-saving rules, and no formatting ambiguity, it is the standard way computers store and exchange points in time. Databases, log files, APIs, and operating systems all use it internally; a human-readable date is only produced at display time, in whatever time zone the viewer needs.
Unix time in seconds vs milliseconds
The same instant can be expressed at different precisions. You can usually tell which one you are looking at by the number of digits:
| Unit | Digits (today) | Example | Typical source |
|---|---|---|---|
| eiliadau | 10 | 1758700800 | Unix tools, PHP, MySQL, Python time.time() |
| milieiliadau | 13 | 1758700800000 | JavaScript Date.now(), Java |
| microseconds | 16 | 1758700800000000 | High-resolution logging |
| nanoseconds | 19 | 1758700800000000000 | Go UnixNano(), tracing systems |
The year 2038 problem
Systems that store Unix time in a signed 32-bit integer overflow at 03:14:07 UTC on January 19, 2038 (timestamp 2,147,483,647). One second later the counter wraps to a negative number, which such systems interpret as December 1901. Modern 64-bit systems are unaffected — a 64-bit counter lasts roughly 292 billion years — but legacy embedded devices, old file formats, and databases using 32-bit fields still need attention.
Get the current Unix timestamp in code
In seconds unless noted.
# Shell date +%s # JavaScript (ms → s) Math.floor(Date.now() / 1000) # Python import time; int(time.time()) # Perl time # PHP time() # MySQL SELECT UNIX_TIMESTAMP(); # C# DateTimeOffset.UtcNow.ToUnixTimeSeconds() # Swift Int(Date().timeIntervalSince1970) # Kotlin / Java System.currentTimeMillis() / 1000
Convert a Unix timestamp to a date in code
# Shell (GNU/Linux) date -u -d @1700000000 # Shell (macOS/BSD) date -u -r 1700000000 # JavaScript (ms) new Date(1700000000 * 1000).toISOString() # Python from datetime import datetime, timezone datetime.fromtimestamp(1700000000, tz=timezone.utc) # Perl scalar gmtime(1700000000) # PHP gmdate('Y-m-d H:i:s', 1700000000) # MySQL SELECT FROM_UNIXTIME(1700000000); # C# DateTimeOffset.FromUnixTimeSeconds(1700000000).UtcDateTime # Swift Date(timeIntervalSince1970: 1700000000) # Kotlin / Java java.time.Instant.ofEpochSecond(1700000000)
Notable Unix timestamps
Round numbers and milestones developers run into in logs, test data, and bug reports. All dates are UTC.
| Timestamp | Date (UTC) | Why it matters |
|---|---|---|
| 0 | 1970-01-01 00:00:00 | The Unix epoch itself. A date showing 1970 usually means a missing or zero value. |
| 1000000000 | 2001-09-09 01:46:40 | First 10-digit timestamp (the "billennium"). |
| 1234567890 | 2009-02-13 23:31:30 | Sequential digits, celebrated by developers worldwide. |
| 1500000000 | 2017-07-14 02:40:00 | 1.5 billion seconds. |
| 1700000000 | 2023-11-14 22:13:20 | 1.7 billion seconds. |
| 2000000000 | 2033-05-18 03:33:20 | 2 billion seconds. |
| 2147483647 | 2038-01-19 03:14:07 | Maximum signed 32-bit value — the year 2038 problem. |
How to convert a Unix timestamp
Timestamp to date: paste the number into the converter above. The unit is detected from its length — 10 digits means seconds, 13 means milliseconds — and the result is shown in UTC, in your local time zone, and as relative time. No sign-up, nothing leaves your browser.
Date to timestamp: pick a date and time, choose whether it should be read as local time or UTC, and you get the value in both seconds and milliseconds — ready for SQL queries, token expiry times, or API parameters.
A quick sanity check when debugging: if a date in your data shows up as January 1970, you almost certainly treated a seconds value as milliseconds (or received 0/null). If it shows up tens of thousands of years in the future, you did the opposite.
Cwestiynau cyffredin
Is a Unix timestamp in seconds or milliseconds?
Both are common. A 10-digit value is seconds (Unix tools, PHP, MySQL, Python); a 13-digit value is milliseconds (JavaScript, Java). Divide by 1,000 to go from milliseconds to seconds.
Does Unix time depend on time zones?
No. Unix time is always counted in UTC, so the same instant has the same timestamp everywhere in the world. Time zones only come into play when a timestamp is formatted into a human-readable date.
Do Unix timestamps include leap seconds?
No. Every day counts as exactly 86,400 seconds. When a leap second occurs, operating systems repeat or "smear" it, keeping Unix time a clean, continuous counter.
Can a Unix timestamp be negative?
Yes. Negative values represent moments before January 1, 1970. For example, -86400 is December 31, 1969, 00:00 UTC. Not every system handles negative timestamps correctly, so test before relying on them.
How do I get the current Unix timestamp?
Run date +%s in a Linux or macOS terminal, call Math.floor(Date.now() / 1000) in JavaScript, or int(time.time()) in Python. Snippets for more languages are listed above.
What timestamp is "now"?
The live counter at the top of this page — it updates every second and you can copy it with one click.
More free developer tools
Same idea: fast, free, and everything runs in your browser.