Unix Time & Date Format Cheat Sheet
What Unix time is, how to recognise seconds, milliseconds and nanoseconds, every common date format, and how to convert in your language.
Updated 28 October 2026
Convert any timestamp or date, in any time zone, with code snippets for your language.
Open the epoch converterWhat Unix time is
Unix time (also called epoch time or POSIX time) counts the seconds since 00:00:00 UTC on 1 January 1970. It is the same number everywhere in the world at the same moment — time zones only matter when you turn it into a date. Leap seconds are ignored, so every day is exactly 86,400 seconds.
| Unit | Digits today | Example (28 Oct 2026, 00:00 UTC) | Used by |
|---|---|---|---|
| Seconds | 10 | 1793145600 | Unix, PHP time(), Go .Unix(), JWT exp |
| Milliseconds | 13 | 1793145600000 | JavaScript Date.now(), Java currentTimeMillis() |
| Microseconds | 16 | 1793145600000000 | PostgreSQL timestamps, Python datetime |
| Nanoseconds | 19 | 1793145600000000000 | Go .UnixNano(), Python time.time_ns() |
The epoch converter detects the unit from the number of digits.
Notable timestamps
| Timestamp | Date (UTC) | Why it matters | |
|---|---|---|---|
0 | 1970-01-01 00:00:00 UTC | The Unix epoch | Try ↗ |
1000000000 | 2001-09-09 01:46:40 UTC | Unix time reached a billion | Try ↗ |
1234567890 | 2009-02-13 23:31:30 UTC | The famous "1234567890" moment | Try ↗ |
1700000000 | 2023-11-14 22:13:20 UTC | Try ↗ | |
1800000000 | 2027-01-15 08:00:00 UTC | Try ↗ | |
2000000000 | 2033-05-18 03:33:20 UTC | Two billion seconds | Try ↗ |
2147483647 | 2038-01-19 03:14:07 UTC | Largest signed 32-bit value — the Year 2038 problem | Try ↗ |
4294967295 | 2106-02-07 06:28:15 UTC | Largest unsigned 32-bit value | Try ↗ |
-2147483648 | 1901-12-13 20:45:52 UTC | Smallest signed 32-bit value | Try ↗ |
Durations in seconds
| Duration | Seconds | Milliseconds |
|---|---|---|
| 1 minute | 60 | 60000 |
| 1 hour | 3600 | 3600000 |
| 1 day | 86400 | 86400000 |
| 1 week | 604800 | 604800000 |
| 30 days | 2592000 | 2592000000 |
| 365 days | 31536000 | 31536000000 |
| 366 days (leap year) | 31622400 | 31622400000 |
Date and time formats
| Format | Example | Where you see it |
|---|---|---|
| ISO 8601 / RFC 3339 (UTC) | 2026-10-28T09:30:00Z | APIs, JSON, logs. The safest choice |
| ISO 8601 with offset | 2026-10-28T15:00:00+05:30 | Same moment, local wall-clock time |
| ISO 8601 date only | 2026-10-28 | Birthdays, due dates |
| ISO week date | 2026-W44-3 | Week-based planning (Wednesday of week 44) |
| ISO ordinal date | 2026-301 | Day 301 of the year |
| RFC 2822 | Wed, 28 Oct 2026 09:30:00 +0000 | Email Date: headers, RSS |
| HTTP date (RFC 7231) | Wed, 28 Oct 2026 09:30:00 GMT | Last-Modified, Expires, cookies |
| SQL DATETIME | 2026-10-28 09:30:00 | MySQL, SQLite — no time zone stored |
| Unix seconds | 1793179800 | Databases, JWT, file systems |
RFC 3339 is a strict profile of ISO 8601: it always has a date, a time and an offset (Z or ±hh:mm).
Format codes: strftime, Java and Go
| Meaning | strftime (C, Python, PHP, Bash) | Java / Kotlin | Go layout |
|---|---|---|---|
| Year, 4 digits | %Y | yyyy | 2006 |
| Month 01–12 | %m | MM | 01 |
| Day 01–31 | %d | dd | 02 |
| Hour 00–23 | %H | HH | 15 |
| Hour 01–12 | %I | hh | 03 |
| Minute | %M | mm | 04 |
| Second | %S | ss | 05 |
| Fraction of a second | %f (microseconds, Python) | SSS (ms) | .000 |
| AM / PM | %p | a | PM |
| Weekday, short | %a | EEE | Mon |
| Month, short | %b | MMM | Jan |
| UTC offset | %z (+0530) | XXX (+05:30) | -07:00 |
| Time zone name | %Z | z | MST |
| ISO 8601 shortcut | %Y-%m-%dT%H:%M:%S%z | DateTimeFormatter.ISO_OFFSET_DATE_TIME | time.RFC3339 |
Go formats by example: its reference time is Mon Jan 2 15:04:05 MST 2006 (1 2 3 4 5 6 7).
Unix time in code
| Language | Current Unix time (seconds) | Timestamp → date |
|---|---|---|
| JavaScript | Math.floor(Date.now() / 1000) | new Date(ts * 1000) |
| Python | int(time.time()) | datetime.fromtimestamp(ts, tz=timezone.utc) |
| Go | time.Now().Unix() | time.Unix(ts, 0).UTC() |
| Java | Instant.now().getEpochSecond() | Instant.ofEpochSecond(ts) |
| C# | DateTimeOffset.UtcNow.ToUnixTimeSeconds() | DateTimeOffset.FromUnixTimeSeconds(ts) |
| PHP | time() | date('c', $ts) |
| PostgreSQL | extract(epoch FROM now())::bigint | to_timestamp(ts) |
| MySQL | UNIX_TIMESTAMP() | FROM_UNIXTIME(ts) |
| Bash | date +%s | date -u -d @ts (Linux), date -u -r ts (macOS) |
Gotchas
- Seconds vs milliseconds. JavaScript and Java use milliseconds; most other systems use seconds. A date in January 1970 usually means you passed seconds where milliseconds were expected.
- Timestamps have no time zone. They are always UTC. Convert to a local time only when you display it.
- JavaScript parsing quirk.
new Date('2026-10-28')is read as UTC, butnew Date('2026-10-28T09:30')(noZ) is read as local time. - The Year 2038 problem. Systems that store Unix time in a signed 32-bit integer overflow at
2147483647(19 January 2038, 03:14:07 UTC). Use 64-bit integers. - Store UTC. Save timestamps or UTC dates in the database and keep the user's time zone separately. Avoid MySQL
DATETIMEfor moments in time unless every value is UTC. - Daylight saving. Some local times happen twice (autumn) and some never happen (spring). Do date arithmetic in UTC or with a time-zone-aware library.
Frequently asked questions
What is the current Unix timestamp?
Math.floor(Date.now() / 1000) in JavaScript or date +%s in a terminal.Is Unix time in seconds or milliseconds?
Does Unix time include leap seconds?
What happens in 2038?
Is ISO 8601 the same as RFC 3339?
2026-10-28T09:30:00Z.