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 epoch converter lets you translate between these numeric timestamps and human-readable dates. Enter a timestamp to see the date, or pick a date to get its epoch value. It auto-detects whether you're working in seconds, milliseconds, microseconds, or nanoseconds.

How This Epoch Converter Works

To convert a timestamp to a date, the converter 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 1970 to your chosen date. Results are shown in local time, UTC, and ISO 8601 formats.

Supported Formats

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

Common 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 common conversions using this epoch converter.

Convert Epoch to Date

Convert a timestamp to a readable date

Paste any epoch timestamp into the input field above and the converter will instantly show the corresponding 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)

Convert Date to Epoch

Get the epoch value for any date

Use the date picker above to select a date and time. The epoch converter will generate the corresponding 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

How to convert unix time to date and date to epoch in popular programming languages.

JavaScript

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

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 convert epoch time to datetime, and timestamp() to convert Python datetime to epoch. Always use timezone.utc for consistent UTC conversions. For epoch time in Python, the timestamp() method returns seconds as a float.

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 convert unix timestamp to datetime, and UNIX_TIMESTAMP() to convert datetime to epoch. These functions work with seconds, so divide millisecond timestamps 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 convert unix timestamp to date, and EXTRACT(EPOCH FROM ...) to convert epoch to timestamp. Use AT TIME ZONE for timezone conversions. PostgreSQL convert epoch to timestamp returns a timestamp with time zone 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 epoch time natively. Use Instant.ofEpochSecond() for seconds 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 Unix() to create time from epoch and Unix() method to get epoch from time.

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 comprehensive time handling with 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 epoch seconds and strtotime() or DateTime 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?

Epoch time is 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 epoch to date?

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

How do I convert date to epoch?

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

What is the current epoch time?

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

Seconds vs milliseconds - what's the difference?

Epoch seconds (10 digits) is the standard Unix format. Epoch milliseconds (13 digits) is used by JavaScript, Java, and most APIs. This epoch converter auto-detects which one you're using.

Is this epoch converter free?

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