ShareYourGroupShareYourGroupTime and Data Calculators

Unix time in code: Python, JavaScript, Bash, PowerShell and Excel (all run)

Each snippet below was run on 14 November 2026, and the output is printed under it.

The test instant

We used 1700000000 seconds, which is 2023-11-14T22:13:20Z in UTC. For each language we ran three things: convert the timestamp to an ISO date in UTC, convert the date back to a timestamp, and get the current time. The current time changes every second; we only checked that the result is a 10-digit number.

Python

Timestamp to UTC date

from datetime import datetime, timezone
print(datetime.fromtimestamp(1700000000, timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ'))

Output: 2023-11-14T22:13:20Z

UTC date to timestamp

from datetime import datetime, timezone
print(int(datetime(2023, 11, 14, 22, 13, 20, tzinfo=timezone.utc).timestamp()))

Output: 1700000000

Current time (seconds)

import time
print(int(time.time()))

Output: a 10-digit number, for example 1794597496

JavaScript (Node.js)

Timestamp to UTC date

console.log(new Date(1700000000 * 1000).toISOString().replace('.000Z', 'Z'));

Output: 2023-11-14T22:13:20Z

UTC date to timestamp

console.log(Math.floor(Date.parse('2023-11-14T22:13:20Z') / 1000));

Output: 1700000000

Current time (seconds)

console.log(Math.floor(Date.now() / 1000));

Output: a 10-digit number, for example 1794597496

Bash (GNU date)

Timestamp to UTC date

date -u -d @1700000000 +%Y-%m-%dT%H:%M:%SZ

Output: 2023-11-14T22:13:20Z

UTC date to timestamp

date -u -d 2023-11-14T22:13:20Z +%s

Output: 1700000000

Current time (seconds)

date +%s

Output: a 10-digit number, for example 1794597496

PowerShell

Timestamp to UTC date

[DateTimeOffset]::FromUnixTimeSeconds(1700000000).UtcDateTime.ToString('yyyy-MM-ddTHH:mm:ssZ')

Output: 2023-11-14T22:13:20Z

UTC date to timestamp

[DateTimeOffset]::Parse('2023-11-14T22:13:20Z').ToUnixTimeSeconds()

Output: 1700000000

Current time (seconds)

[DateTimeOffset]::UtcNow.ToUnixTimeSeconds()

Output: a 10-digit number, for example 1794597497

Excel

Timestamp in A1 to UTC date text

=TEXT(A1/86400+DATE(1970,1,1),"yyyy-mm-ddThh:mm:ss")&"Z"

Excel showed: 2023-11-14T22:13:20Z

Date in A1 to timestamp text

=TEXT(ROUND((A1-DATE(1970,1,1))*86400,0),"0")

Excel showed: 1700000000

Notes on the differences

Mind the units

If your number has 13 digits, it is milliseconds: divide by 1000 first. Some languages (Java's System.currentTimeMillis(), JavaScript) use milliseconds; others (Python's time.time(), date +%s) use seconds.

Mind the zone

All the snippets that print Z are in UTC. If you print the date in local time, the result depends on the machine's zone. For logs and storage, use UTC.

How do I get milliseconds in Python?

int(time.time() * 1000).

Which languages are not here?

We only list snippets we ran. If you use another language, check its documentation for "epoch" or "Unix time".

This is an independent guide. It is not connected with the IERS, BIPM, IANA, NIST or any company named here. Facts were read on 14 November 2026 from the sources named on each page; calculated values come from Python.