Unix Timestamp Converter
Convert Unix timestamps between seconds, milliseconds, microseconds, and nanoseconds. Detects the unit automatically, keeps full precision for 19-digit values, and shows the date in UTC and local time. Runs in your browser.
Input
Output
Readme
What is Unix time?
Unix time (also called epoch time or a POSIX timestamp) counts the time since 00:00:00 UTC on January 1, 1970. Different systems count it in different units: Unix shells, PHP, and most databases use seconds, JavaScript and Java use milliseconds, Python's time.time_ns(), Go, and InfluxDB offer nanoseconds, and many tracing and logging tools use microseconds. The same moment is 1700000000 in seconds and 1700000000000000000 in nanoseconds, so mixing up the unit puts a date off by thousands of years.
Tool description
This tool converts a Unix timestamp between seconds, milliseconds, microseconds, and nanoseconds, and shows the date it stands for. Paste a timestamp and the unit is detected from its length, or pick the unit yourself. Every conversion is exact, including nanosecond timestamps that are too large for a regular JavaScript number.
Features
- Converts between seconds, milliseconds, microseconds, and nanoseconds in one step
- Detects the input unit from the number of digits, or lets you choose it
- Keeps full precision with no rounding errors, even for 19-digit nanosecond values
- Accepts fractions (
1700000000.123), negative values for dates before 1970, and scientific notation (1.7e9) - Optional whole-number output for APIs that expect integers
- Shows the date as ISO 8601 in UTC, with up to nanosecond precision, and in your local time zone
- Hide the microsecond and nanosecond fields if you don't need them
How it works
The timestamp is read as an exact decimal number and stored as a whole number of nanoseconds, using arbitrary-precision integers instead of floating point. Each output divides that value by the size of its unit and writes the exact result, so converting milliseconds to seconds gives 1700000000.123 rather than a rounded value. With "Whole numbers only", the result is rounded down to the unit it falls in, which is also how Unix time handles dates before 1970: -1.5 seconds becomes -2.
When the unit is detected automatically, the tool assumes a date between 1973 and 5138: up to 11 digits is read as seconds, 12 to 14 as milliseconds, 15 to 17 as microseconds, and 18 or more as nanoseconds.
Tips
- Detection by length can't tell short values apart, such as a millisecond timestamp from before March 1973 and a seconds timestamp. If the date looks wrong, pick the input unit yourself.
- "Now" fills in the current time in the unit you're using. Browsers only give the time to the millisecond, so the last digits of microsecond and nanosecond values are zeros.
- Spaces and underscores in the input are ignored, so you can paste values like
1_700_000_000.