Converter Live Clock

Input

Enter timestamp or date

Quick Presets
Minute
Hour
Day
Week
Month
Year

Output

Converted formats

Timestamps
Seconds -
Milliseconds -
Microseconds -
Nanoseconds -
Local Time
12-Hour -
24-Hour -
GMT / UTC
12-Hour -
24-Hour -
ISO 8601 -

What is Epoch Time?

Epoch time (also known as Unix time or POSIX time) is a way of tracking time as a single number — the total seconds elapsed since January 1, 1970, 00:00:00 UTC. That starting point is called the Unix epoch. For example, the timestamp 0 represents that exact moment, 86400 is exactly one day later, and 1704067200 is January 1, 2024.

This tool lets you translate between numeric unix timestamps and human-readable dates — convert unix time to date or convert a date to epoch seconds. The format — seconds, milliseconds, microseconds, or nanoseconds — is detected automatically.

How the Converter Works

To convert a unix timestamp to date, the tool breaks the number down into years, months, days, hours, minutes, and seconds relative to the 1970 epoch. To go the other way, it counts the total seconds from the unix epoch to your chosen date. Results are shown in local time, UTC, and ISO 8601 formats.

Supported Unix Time Formats

  • Seconds (10 digits) — Standard unix time format, used by Python, PHP, Ruby, and most Linux timestamp systems
  • Milliseconds (13 digits) — Used by JavaScript, Java, and most modern APIs and databases
  • Microseconds (16 digits) — Common in high-precision logging and database timestamps
  • Nanoseconds (19 digits) — Used in performance profiling and scientific applications

Common Unix Time Intervals in Seconds

1 minute 60 seconds
1 hour 3,600 seconds
1 day 86,400 seconds
1 week 604,800 seconds
1 year 31,536,000 seconds

Epoch Converter

Quick reference for converting epoch time to date and date to epoch using this tool.

Unix Timestamp to Date

Convert an epoch timestamp to a readable date

Paste any unix timestamp into the input field above to convert unix time to date. It works with both seconds (10 digits) and milliseconds (13 digits) — the format is detected automatically.

Examples:

1704067200 Mon, Jan 1, 2024, 00:00:00 UTC
1704067200000 Mon, Jan 1, 2024, 00:00:00 UTC (milliseconds)
0 Thu, Jan 1, 1970, 00:00:00 UTC (the epoch)

Date to Unix Timestamp

Get the unix time value for any date

Use the date picker above to convert a date to epoch. The tool will generate the corresponding unix timestamp in both seconds and milliseconds. You can switch between local time and UTC input.

Examples:

January 1, 2024 00:00 UTC 1704067200
2024-06-15T12:30:00Z 1718451000
December 31, 2024 23:59:59 UTC 1735689599

Convert Epoch Time in Code

Examples showing how to convert unix time to date and date to unix timestamp in popular programming languages.

JavaScript

JavaScript's built-in Date object works with milliseconds internally, so multiply or divide by 1000 when working with unix time in seconds. Use getTime() to get the epoch timestamp from a date, and pass milliseconds directly to the Date constructor to convert back.

Epoch to Date
// Convert unix timestamp to date in JavaScript
const epochSeconds = 1704067200;
const date = new Date(epochSeconds * 1000);
console.log(date.toISOString()); // 2024-01-01T00:00:00.000Z
console.log(date.toLocaleString()); // Local format

// For epoch milliseconds (no multiplication needed)
const epochMs = 1704067200000;
const dateFromMs = new Date(epochMs);
Date to Epoch
// Convert JavaScript date to epoch timestamp
const now = new Date();
const epochMs = now.getTime();        // Milliseconds
const epochSec = Math.floor(now.getTime() / 1000); // Seconds

// Convert specific date string to unix timestamp
const specificDate = new Date('2024-01-01T00:00:00Z');
const timestamp = Math.floor(specificDate.getTime() / 1000);

Python

Python's datetime module provides fromtimestamp() to turn a unix timestamp into a datetime object, and timestamp() to go the other way. Always pass timezone.utc for consistent UTC results — the method returns seconds as a float by default.

Epoch to Date
from datetime import datetime, timezone

# Python convert epoch to datetime (local time)
epoch_seconds = 1704067200
dt_local = datetime.fromtimestamp(epoch_seconds)
print(dt_local)  # 2024-01-01 05:30:00 (depends on timezone)

# Python convert unix timestamp to datetime (UTC)
dt_utc = datetime.fromtimestamp(epoch_seconds, tz=timezone.utc)
print(dt_utc)  # 2024-01-01 00:00:00+00:00

# For epoch milliseconds, divide by 1000
epoch_ms = 1704067200000
dt = datetime.fromtimestamp(epoch_ms / 1000, tz=timezone.utc)
Date to Epoch
from datetime import datetime, timezone

# Python datetime to epoch (current time)
now = datetime.now(timezone.utc)
epoch_seconds = int(now.timestamp())

# Python convert datetime to unix timestamp
dt = datetime(2024, 1, 1, 0, 0, 0, tzinfo=timezone.utc)
epoch = int(dt.timestamp())  # 1704067200

MySQL

MySQL provides FROM_UNIXTIME() to turn a unix timestamp into a datetime, and UNIX_TIMESTAMP() to go from a date back to epoch seconds. Both functions work with seconds, so divide millisecond values by 1000. You can also format the output using MySQL's date format specifiers.

Epoch to Date
-- MySQL convert unix timestamp to datetime
SELECT FROM_UNIXTIME(1704067200);
-- Result: 2024-01-01 00:00:00

-- MySQL convert epoch to date with custom format
SELECT FROM_UNIXTIME(1704067200, '%Y-%m-%d %H:%i:%s');

-- For milliseconds, divide by 1000
SELECT FROM_UNIXTIME(1704067200000 / 1000);
Date to Epoch
-- MySQL convert datetime to unix timestamp
SELECT UNIX_TIMESTAMP('2024-01-01 00:00:00');
-- Result: 1704067200

-- MySQL get current epoch timestamp
SELECT UNIX_TIMESTAMP(NOW());

PostgreSQL

PostgreSQL uses to_timestamp() to turn epoch seconds into a timestamptz value, and EXTRACT(EPOCH FROM ...) to get the unix time from a date. Use AT TIME ZONE to control timezone output — the result includes timezone info by default.

Epoch to Date
-- PostgreSQL convert unix timestamp to date
SELECT to_timestamp(1704067200);
-- Result: 2024-01-01 00:00:00+00

-- PostgreSQL convert epoch to timestamp with timezone
SELECT to_timestamp(1704067200) AT TIME ZONE 'UTC';

-- For milliseconds, divide by 1000
SELECT to_timestamp(1704067200000 / 1000.0);
Date to Epoch
-- PostgreSQL convert timestamp to unix epoch
SELECT EXTRACT(EPOCH FROM TIMESTAMP '2024-01-01 00:00:00');
-- Result: 1704067200

-- PostgreSQL get current epoch timestamp
SELECT EXTRACT(EPOCH FROM NOW());

Java

Java's Instant class (Java 8+) handles unix time natively. Use Instant.ofEpochSecond() for second-precision timestamps or Instant.ofEpochMilli() for milliseconds.

Epoch to Date
import java.time.*;

// Java convert epoch to date
long epochSeconds = 1704067200L;
Instant instant = Instant.ofEpochSecond(epochSeconds);
ZonedDateTime utc = instant.atZone(ZoneOffset.UTC);
// 2024-01-01T00:00:00Z

// For milliseconds
Instant fromMs = Instant.ofEpochMilli(1704067200000L);
Date to Epoch
// Java convert date to epoch
Instant now = Instant.now();
long epochSec = now.getEpochSecond();
long epochMs = now.toEpochMilli();

// From specific date
long epoch = LocalDateTime.of(2024, 1, 1, 0, 0)
    .toEpochSecond(ZoneOffset.UTC);

Go

Go's time package uses time.Unix() to create a time value from epoch seconds, and the .Unix() method on any Time to get the timestamp back.

Epoch to Date
import "time"

// Go convert epoch to time
epochSec := int64(1704067200)
t := time.Unix(epochSec, 0).UTC()
// 2024-01-01 00:00:00 +0000 UTC

// For milliseconds
epochMs := int64(1704067200000)
t := time.UnixMilli(epochMs).UTC()
Date to Epoch
// Go convert time to epoch
now := time.Now()
epochSec := now.Unix()
epochMs := now.UnixMilli()

// From specific date
t := time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC)
epoch := t.Unix() // 1704067200

Rust

Rust's chrono crate provides full timestamp handling through DateTime and Utc types.

Epoch to Date
use chrono::{DateTime, Utc};

// Rust convert epoch to datetime
let epoch_sec = 1704067200_i64;
let dt = DateTime::from_timestamp(epoch_sec, 0)
    .unwrap();
// 2024-01-01T00:00:00Z

// For milliseconds
let dt = DateTime::from_timestamp_millis(1704067200000)
    .unwrap();
Date to Epoch
// Rust convert datetime to epoch
let now: DateTime<Utc> = Utc::now();
let epoch_sec = now.timestamp();
let epoch_ms = now.timestamp_millis();

PHP

PHP uses date() with a unix timestamp and strtotime() or the DateTime class for conversions.

Epoch to Date
// PHP convert epoch to date
$epoch = 1704067200;
$date = date('Y-m-d H:i:s', $epoch);
// 2024-01-01 00:00:00

// Using DateTime
$dt = new DateTime("@$epoch");
$dt->setTimezone(new DateTimeZone('UTC'));
Date to Epoch
// PHP convert date to epoch
$epoch = time(); // current timestamp
$epoch = strtotime('2024-01-01 00:00:00 UTC');

// Using DateTime
$dt = new DateTime('2024-01-01', new DateTimeZone('UTC'));
$epoch = $dt->getTimestamp();

Frequently Asked Questions

What is epoch time?

Also called unix time or POSIX time, it's the number of seconds since January 1, 1970 00:00:00 UTC. It's used across operating systems, databases, and programming languages as a universal way to represent a point in time as a single number.

How do I convert a unix timestamp to date?

Paste the timestamp into the input field above. The tool instantly shows the corresponding date in local time, UTC, and ISO 8601 format. Both seconds and milliseconds are supported.

How do I convert a date to unix time?

Use the date picker to select a date and time. The converter generates the corresponding timestamp in seconds and milliseconds. You can input in either local time or UTC.

What is the current unix time?

Click "Set Current Time" to see the live timestamp. You can also visit our unix epoch clock to watch it update in real-time.

Seconds vs milliseconds — what's the difference?

A unix timestamp in seconds is 10 digits and is the standard format on most systems. Milliseconds (13 digits) are used by JavaScript, Java, and most web APIs. The converter auto-detects which one you're using.

Is this tool free to use?

Yes, completely free with no signup or limits. All conversions happen in your browser — nothing is sent to a server.