Convert Date to Unix Timestamp

Going from a calendar date to a Unix timestamp means measuring how many seconds separate that moment from the Unix epoch. Because the epoch is defined in UTC, the result is the same everywhere on Earth for a given instant.

Paste an ISO 8601 string, a plain date, or even natural language such as “next friday 5pm” — the parser resolves it and returns the timestamp in seconds and milliseconds, ready to drop into your database or API call.

Worked example

Input 2023-11-14T22:13:20Z converts to 1700000000:

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

How is a date converted to a Unix timestamp?
The date is interpreted as an absolute instant (using its zone or offset), then the number of whole seconds since 1970-01-01T00:00:00Z is computed.
What if my date string has no time zone?
A bare date/time is interpreted in your local zone by the browser. Add a 'Z' or an offset like +05:30 to make it explicit and unambiguous.
Can I convert natural language dates?
Yes — phrases like 'tomorrow', 'in 3 hours', or 'next monday 9am' are parsed and turned into a precise timestamp.

Related conversions

Copied