Unix Timestamp (Epoch) Converter
Paste a Unix epoch, seconds, milliseconds, microseconds, or nanoseconds, and read it back as a date in UTC, Sri Lanka time, and your own zone, plus relative time, ISO-week facts, and a Year-2038 check. Or go the other way, date to epoch. Everything runs in your browser; nothing is uploaded.
How it works
A Unix timestamp is a single integer: the number of seconds since the epoch, 1970-01-01T00:00:00Z, defined by POSIX.1-2017 §4.16. Because it carries no time zone, the same number means the same instant everywhere, the converter's only job is to render that instant clearly and to reverse the process exactly.
- Resolve the unit. On Auto-detect, the digit count decides the unit. The canonical lengths (10 = seconds, 13 = milliseconds, 16 = microseconds, 19 = nanoseconds) each sit inside a band:
- 1–11 digits → seconds
- 12–14 digits → milliseconds
- 15–17 digits → microseconds
- 18–19 digits → nanoseconds
- Normalise to milliseconds. The value is scaled to milliseconds using exact BigInt arithmetic so a 19-digit nanosecond figure never loses precision to floating point. Microsecond and nanosecond inputs are floor-divided; any sub-millisecond remainder is reported separately rather than rounded into the date.
- Build the civil date. The millisecond instant is decomposed into a year/month/day and hour/minute/second using UTC fields only, so the host machine's local offset can never leak into a UTC answer. This matches the POSIX relation
days = ⌊seconds / 86400⌋with the remainder giving the time of day, cross-checked against Howard Hinnant's constant-time days-to-civil algorithm. - Apply target offsets. UTC is shown with the Z suffix; Sri Lanka adds a fixed +05:30 (Asia/Colombo, no DST since 1996); your local zone uses the offset your browser reports for that exact instant, so historical daylight saving is handled correctly.
- Format. Each zone is emitted as ISO 8601 / RFC 3339, with an RFC 2822 string for email and HTTP-style dates. The same epoch is echoed in all four units for easy copy-paste.
- Reverse direction. Date → Epoch parses your calendar input in the chosen zone, converts it to a UTC instant, and reads back the epoch in every unit. The forward and reverse paths are inverses, so a value round-trips to itself.
- Derived facts. Day of week comes from the UTC weekday; day of year by differencing from 1 January; the ISO-8601 week number uses the Monday-start, first-Thursday rule; and leap years follow the Gregorian rule
(y%4==0 && y%100!=0) || y%400==0.
Worked examples
Frequently asked questions
Sources & references
- IEEE Std 1003.1-2017 (POSIX.1) §4.16: Seconds Since the Epoch
- ISO 8601-1:2019: Date and time representations
- RFC 3339: Date and Time on the Internet: Timestamps
- RFC 2822 §3.3: Date and Time Specification
- IANA Time Zone Database: Asia/Colombo (+05:30)
Conversion logic was last cross-checked against these standards on 2026-06-08. Unix time ignores leap seconds by design (POSIX §4.16), so every day is treated as exactly 86,400 seconds.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us, our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, edge case, or want to suggest an improvement?
Email me at [email protected] , most fixes ship within 24 hours.