Convert Unix Timestamp to Date

Enter Unix timestamp (seconds or milliseconds)

Human-Readable Date
ISO 8601 Format
Unix Timestamp (milliseconds)
Unix Timestamp (seconds)

Last updated

Common Mistakes

Use the Epoch Converter tool to verify your Python conversions instantly.

Examples

Example 1: Basic Conversion with datetime Module

from datetime import datetime

unix_timestamp = 1710000000  # seconds since epoch

# Convert to UTC datetime
utc_date = datetime.utcfromtimestamp(unix_timestamp)
print(utc_date)
# 2024-03-09 21:20:00

# Convert to local system timezone
local_date = datetime.fromtimestamp(unix_timestamp)
print(local_date)
# 2024-03-09 22:20:00 (if you're in UTC+1)

Example 2: Formatting the Date with strftime

from datetime import datetime

ts = 1710000000
date = datetime.utcfromtimestamp(ts)

# ISO 8601 format
print(date.strftime('%Y-%m-%dT%H:%M:%SZ'))
# 2024-03-09T21:20:00Z

# Human-readable
print(date.strftime('%B %d, %Y at %I:%M %p'))
# March 09, 2024 at 09:20 PM

# Date only
print(date.strftime('%Y-%m-%d'))
# 2024-03-09

# Common format codes:
# %Y = 4-digit year    %m = 2-digit month   %d = 2-digit day
# %H = 24h hour        %M = minutes         %S = seconds
# %I = 12h hour        %p = AM/PM           %A = weekday name

Example 3: Handling Millisecond Timestamps

JavaScript and many modern APIs return timestamps in milliseconds. Divide by 1000 before converting:

from datetime import datetime

# Millisecond timestamp (13 digits)
ms_timestamp = 1710000000000

# Divide by 1000 to get seconds
date = datetime.utcfromtimestamp(ms_timestamp / 1000)
print(date)
# 2024-03-09 21:20:00

# Helper function that handles both
def to_datetime(timestamp):
    if timestamp > 1e12:  # milliseconds
        return datetime.utcfromtimestamp(timestamp / 1000)
    return datetime.utcfromtimestamp(timestamp)

Frequently Asked Questions

Enter the Unix timestamp (in seconds or milliseconds) and click Convert. The tool automatically detects the format and displays the date in multiple formats including ISO 8601.

A Unix timestamp is the number of seconds (or milliseconds) since January 1, 1970, 00:00:00 UTC. It's a universal time format used across programming languages and databases.