Date to Epoch Converter
Convert calendar dates, clock times, and full datetimes into Unix epoch seconds and milliseconds. Choose a timezone, get UTC and ISO output, and avoid DST or unit mistakes.
Convert date, time, or datetime to Unix timestamp
Use this page when the input starts as a human-readable date: a calendar day, a clock time, or a complete datetime. Pick the timezone where that wall-clock value should be interpreted, then copy the Unix timestamp in seconds or milliseconds. This covers date to epoch, time to epoch, datetime to Unix epoch, and convert time to Unix timestamp searches with one focused workflow.
- Date to epoch: 2026-06-28 00:00 in America/Los_Angeles becomes one exact UTC instant
- Time to epoch: include the date as well as the clock time so the result is not ambiguous
- Datetime Unix epoch: use an explicit timezone or ISO 8601 offset before copying the integer
- Timestamp to Unix time: if your input is already a date string, this converter returns Unix seconds and milliseconds
When to use seconds or milliseconds
Use seconds for most backend languages, databases, and command-line tools. Use milliseconds for JavaScript Date, browser APIs, analytics events, and systems that need sub-second precision.
- Unix seconds are usually 10 digits for modern dates
- Unix milliseconds are usually 13 digits for modern dates
- ISO 8601 is best when you want a readable string with explicit UTC output
- UTC strings are useful for HTTP headers, logs, and quick human checks
Timezone handling
A local date such as 2026-05-14 08:00 means different instants in Los Angeles, New York, London, or Tokyo. Selecting the timezone before conversion avoids off-by-hours mistakes and handles daylight saving time rules through the browser's Intl API.
Choosing the right date boundary
Date-to-epoch conversion is most useful when the calendar meaning is clear before you generate the number. For scheduled jobs, reporting windows, and database filters, decide whether the boundary is UTC or a business timezone first. Then convert that exact wall-clock time to seconds and milliseconds so every service compares the same instant.
- Use UTC for logs, APIs, CI jobs, and cross-region backend systems
- Use the business timezone for local billing days, store hours, or user-facing calendars
- Prefer exclusive upper bounds such as created_at < nextDayStart for date ranges
- Store the generated timestamp with a short note about the timezone assumption
DST gap, ambiguous local times, and civil time
Most date-to-epoch conversions are unambiguous, but two transitions a year break the assumption that a wall-clock date in a known zone maps to a single Unix timestamp. The spring-forward gap removes a wall-clock hour; the fall-back overlap repeats one. Modern date libraries handle this by separating timezone-naive from timezone-aware values and surfacing an explicit disambiguation choice.
- Civil / wall-clock time: the local clock reading in a specific place
- Timezone-naive: a date-time without a zone — inherently ambiguous
- Timezone-aware: a date-time tagged with an IANA zone — almost always unambiguous
- DST gap (spring-forward): 02:00 to 02:59 local time does not occur on the transition day in most US zones
- DST overlap (fall-back): 01:00 to 01:59 local time occurs twice — pick "earlier" or "later"
- Python: zoneinfo exposes a fold attribute (0 or 1) to disambiguate
- JavaScript Temporal: ZonedDateTime construction takes a disambiguation option ("compatible", "earlier", "later", "reject")
- Java: ZonedDateTime.ofLocal() applies the gap/overlap rules of the supplied ZoneId
- For form input without an explicit timezone, default to the user's IANA zone — not the server's
Examples for high-confidence conversions
These examples show the exact decisions that prevent wrong timestamps in APIs, cron jobs, tests, and database filters.
- API deadline: convert 2026-07-01 09:00 America/New_York to Unix seconds before storing the deadline
- Billing window: convert 2026-06-01 00:00 and 2026-07-01 00:00 in the business timezone, then query start <= created_at < end
- JavaScript fixture: convert a datetime to milliseconds when the test calls new Date(ms)
- SQL filter: convert the wall-clock boundary once, then compare numeric epoch values consistently
Reverse conversion: epoch to time
If you already have a 10-digit or 13-digit Unix integer and need the readable date, use the Epoch to Date converter instead. That page is optimized for epoch to time, convert Unix timestamp to time, and epoch to date queries.
FAQ
- How do I convert a date to epoch time?
- Choose the date, time, and timezone in the converter, then copy the Unix timestamp in seconds or milliseconds. Midnight without a timezone is ambiguous, so select the timezone that owns the calendar day.
- Is time to epoch the same as date to epoch?
- Yes. Both phrases mean converting a human-readable wall-clock value into the number of seconds or milliseconds since 1970-01-01 00:00:00 UTC.
- How do I convert a datetime to a Unix timestamp?
- Enter the full datetime with its intended timezone. The converter returns the matching Unix seconds, Unix milliseconds, ISO 8601, and UTC values for the same instant.
- Should I use Unix seconds or milliseconds?
- Use seconds for most backend languages, databases, and command-line tools. Use milliseconds for JavaScript Date, browser APIs, Java, .NET, and analytics events.