Convert Unix Timestamp to ISO 8601
ISO 8601 is the international standard for representing dates and times as text, e.g. 2023-11-14T22:13:20Z. Its UTC form (the trailing 'Z') is unambiguous and sorts lexicographically, which is why APIs and logs prefer it.
Enter a Unix timestamp to get the canonical ISO 8601 string in UTC, plus the RFC 3339 form with your local offset. Both are valid ISO 8601; the difference is only the time zone designator.
Worked example
Input 1700000000 converts to 2023-11-14T22:13:20.000Z:
- UTC
- Tue, 14 Nov 2023, 22:13:20 UTC
- ISO 8601 (UTC)
- 2023-11-14T22:13:20.000Z
- RFC 3339 (UTC)
- 2023-11-14T22:13:20Z
- RFC 2822
- Tue, 14 Nov 2023 22:13:20 +0000
- Unix seconds
- 1700000000
- Unix milliseconds
- 1700000000000
- Microseconds
- 1700000000000000
- Nanoseconds
- 1700000000000000000
- Hex (seconds)
- 0x6553f100
- Binary (seconds)
- 1100101010100111111000100000000
Code examples
JavaScript
const d = new Date(1700000000000); console.log(d.toISOString()); // 2023-11-14T22:13:20.000Z Math.floor(Date.now() / 1000); // current epoch
Python
from datetime import datetime, timezone print(datetime.fromtimestamp(1700000000, tz=timezone.utc)) # 2023-11-14T22:13:20.000Z import time; int(time.time())
Go
package main
import ("fmt"; "time")
func main() {
fmt.Println(time.Unix(1700000000, 0).UTC()) // 2023-11-14T22:13:20.000Z
fmt.Println(time.Now().Unix())
}See all 14 languages on the code examples pages.
Frequently asked questions
- What is the difference between ISO 8601 and RFC 3339?
- RFC 3339 is a strict profile of ISO 8601 used on the internet. Every RFC 3339 timestamp is valid ISO 8601, but ISO 8601 also allows forms RFC 3339 does not (like week dates).
- What does the 'Z' mean?
- 'Z' (Zulu) is the zone designator for UTC, equivalent to +00:00. It marks the timestamp as Coordinated Universal Time.
- Is ISO 8601 in UTC or local time?
- It can be either — a 'Z' or an explicit offset such as +05:30 tells you which. Without an offset the time zone is unspecified, which you should avoid.