EpochMasters Logo
Calendar to Timestamp Converter

Date to Epoch Converter

Convert calendar dates, human times, and ISO 8601 strings into exact Unix timestamps. Choose your local timezone or UTC with full sub-second precision.

Date to Unix Timestamp

Configure date, time, and timezone to convert to Unix time

Yr
Mon
Day
Hr
Min
Sec
--
::

Understanding Date to Epoch Conversion

Converting a calendar date into an Epoch timestamp is the reverse process of reading a timestamp. It calculates the exact number of seconds that have elapsed between the Unix Epoch baseline (January 1, 1970 00:00:00 UTC) and your specified date and time.

Epoch Timestamp = (Target Date in UTC - 1970-01-01 00:00:00 UTC) in Seconds

Because a calendar date is specified in a localized timezone, the conversion first normalizes your local time into UTC by applying your timezone offset. For example, if you input 2026-10-28 12:00:00 in New York (EDT, UTC-4), the equivalent UTC time is 2026-10-28 16:00:00 UTC, which determines the final integer value.

Convert Date to Unix Timestamp in Popular Languages

Here is how you can parse dates and ISO strings to Unix timestamps across the most common backend and frontend environments:

JavaScript / TypeScriptDate.parse() & getTime()
// From ISO 8601 string to Seconds
const dateString = "2026-10-28T12:00:00Z";
const timestampSeconds = Math.floor(new Date(dateString).getTime() / 1000);

// From Date object to Milliseconds
const dateObj = new Date(2026, 9, 28, 12, 0, 0); // Note: months are 0-indexed
const timestampMs = dateObj.getTime();
Python 3datetime.timestamp()
from datetime import datetime, timezone

# From ISO string to timestamp
dt = datetime.fromisoformat("2026-10-28T12:00:00+00:00")
timestamp_secs = int(dt.timestamp())

# Using specific timezone
from zoneinfo import ZoneInfo
dt_ny = datetime(2026, 10, 28, 12, 0, tzinfo=ZoneInfo("America/New_York"))
print("Timestamp:", int(dt_ny.timestamp()))
PHPstrtotime()
// Convert date string to timestamp
$timestamp = strtotime("2026-10-28 12:00:00 UTC");

// Or using DateTimeImmutable
$date = new DateTimeImmutable("2026-10-28 12:00:00", new DateTimeZone("UTC"));
$epoch = $date->getTimestamp();
SQL (PostgreSQL & MySQL)UNIX_TIMESTAMP & EXTRACT
-- PostgreSQL:
SELECT EXTRACT(EPOCH FROM TIMESTAMP '2026-10-28 12:00:00');

-- MySQL:
SELECT UNIX_TIMESTAMP('2026-10-28 12:00:00');

ISO 8601 Standards and Timezone Offsets

The ISO 8601 date format (e.g., 2026-10-28T12:00:00.000Z) is the gold standard for transmitting dates over web APIs, JSON payloads, and distributed databases.

  • The "T" separator: Separates the date portion (YYYY-MM-DD) from the time portion (HH:mm:ss).
  • The "Z" suffix: Indicates Zero meridian, meaning the time is represented strictly in UTC.
  • Numeric Offsets: Offsets like +05:30 or -04:00 denote how many hours and minutes the localized time is ahead of or behind UTC.

Frequently Asked Questions: Date to Epoch

What happens to timestamps during leap years?

Leap years contain 366 days instead of 365. Because an extra day contains 86,400 seconds, the Unix timestamp simply continues incrementing linearly by 86,400 seconds for February 29th. No special formulas or non-linear jumps are required.

Why does selecting a different timezone change the Unix timestamp?

When you specify a wall-clock time like "12:00 PM", that event happens at completely different physical moments depending on whether you are in Tokyo or New York. The Unix timestamp represents the absolute global moment, so changing the timezone alters the resulting epoch value accordingly.

Explore Companion Time Tools