Turn a timestamp into a date
Paste the number and the result shows the date in several forms at once: a readable date and time in your time zone, the ISO 8601 string, the UTC time, the HTTP date used in headers, a relative time such as "2 years ago", the day of the year and the ISO week. Each value has a Copy button.
1700000000 = Tuesday, November 14, 2023 22:13:20 (UTC) = 2023-11-14T22:13:20.000Z (ISO 8601) = Tue, 14 Nov 2023 22:13:20 GMT (HTTP date)
Batch mode for log files and exports
Paste several timestamps, one per line (spaces and commas also work), and you get a table with the input, the detected unit, the UTC time and the time in your chosen zone. Use it to read a column from a CSV file, a block of log lines or the output of a database query. Up to 500 values are converted at once. A value that is not a number is marked in its own row and does not stop the others.
Accepted formats
- Integers in seconds, milliseconds, microseconds or nanoseconds. Large 19-digit values are handled exactly.
- Decimals such as
1700000000.123, as written by Prometheus, Slack and many logs. The fraction is kept to the millisecond. - Negative values, which are dates before 1970. For example
-86400is 1969-12-31 00:00:00 UTC.
Why a converted date looks wrong
- The year is 1970. The value is in seconds but was treated as milliseconds. A value like
1700000000read as milliseconds is 20 January 1970. Set the unit to seconds. - The year is far in the future. A millisecond value was read as seconds. Set the unit to milliseconds. The page warns you when a value looks too large or too small for the unit.
- The hour is off. The timestamp is right, but the time zone is not. Pick the zone you expect in the Time zone box. The UTC line is always shown for reference.
- The time is off by exactly one hour for some dates. Daylight saving time. Zones that change their clocks use a different offset in summer and winter, and the page applies the one that was valid on that date.
Convert a timestamp to a date in code
// JavaScript
new Date(1700000000 * 1000).toISOString(); // "2023-11-14T22:13:20.000Z"
# Python
from datetime import datetime, timezone
datetime.fromtimestamp(1700000000, tz=timezone.utc)
// PHP
gmdate('Y-m-d H:i:s', 1700000000);
// Java
Instant.ofEpochSecond(1700000000L);
// C#
DateTimeOffset.FromUnixTimeSeconds(1700000000);
// Go
time.Unix(1700000000, 0).UTC()
# Shell (GNU date on Linux)
date -u -d @1700000000
# Shell (macOS / BSD)
date -u -r 1700000000
In a database
-- MySQL (uses the session time zone) SELECT FROM_UNIXTIME(1700000000); -- PostgreSQL SELECT to_timestamp(1700000000); -- SQLite SELECT datetime(1700000000, 'unixepoch'); -- SQL Server SELECT DATEADD(SECOND, 1700000000, '1970-01-01');
In a spreadsheet
=(A1 / 86400) + DATE(1970, 1, 1)
Format the cell as a date and time. The result is in UTC. For milliseconds, divide by 86400000 instead. The Excel and Google Sheets serial number for 1 January 1970 is 25569, which is the same thing.
Related: date to timestamp for the other direction, milliseconds to date for 13-digit values, and the Unix time guide. To read the exp and iat dates inside a token, use Base64URL decode, which shows them as UTC dates.