Convert Date to Unix Timestamp — Free Online Tool

This free tool converts any date and time to a Unix timestamp instantly. Enter a date using the picker or type it directly — the tool returns both the second-precision and millisecond-precision epoch values. All processing happens in your browser; no data leaves your device.

How to Convert Any Date to a Timestamp

Converting a calendar date to a Unix timestamp takes three simple steps:

  1. Pick a datein the Date & Time field below. You can type an ISO 8601 string or use the native date-time picker.
  2. See instant results. The converter updates in real time as you change the date or time value.
  3. Copy the Unix timestamp in seconds (10-digit) or milliseconds (13-digit) — whichever your use case requires.

Date Formats Supported

The tool accepts dates entered through the browser datetime-local input, which standardizes the value to a consistent internal format. Common formats you can type or reference:

  • 2024-01-15T12:00:00Z — ISO 8601 with explicit UTC offset
  • 2024-01-15T12:00:00 — datetime-local picker format (local timezone applied)
  • 2024-01-15 12:00:00 — YYYY-MM-DD HH:MM:SS (common in SQL and logs)
  • The browser datetime-local input normalizes all input to a consistent format before conversion.

Current Unix Timestamp

1776195270

Free — No Limits, No Signup

Convert

or

Results

UTC Time
Local Time
ISO 8601
Relative Time
Unix (seconds)
Unix (milliseconds)
Day of Week
Day of Year
Week Number
Is DST

Date to Timestamp in Code

JavaScript

// Seconds since epoch (UTC)
Math.floor(new Date('2024-01-15T12:00:00Z').getTime() / 1000);
// 1705320000

// UTC-specific using Date.UTC
Math.floor(Date.UTC(2024, 0, 15, 12, 0, 0) / 1000);
// 1705320000

// Local timezone — result depends on system timezone
Math.floor(new Date('2024-01-15 12:00:00').getTime() / 1000);

Python

import calendar, time

# UTC timestamp (calendar.timegm treats input as UTC)
calendar.timegm(time.strptime('2024-01-15 12:00:00', '%Y-%m-%d %H:%M:%S'))
# 1705320000

# Local timezone (time.mktime treats input as local time)
int(time.mktime(time.strptime('2024-01-15 12:00:00', '%Y-%m-%d %H:%M:%S')))

PHP

// strtotime — interprets date in server timezone
strtotime('2024-01-15 12:00:00');
// int

// mktime — explicit components, local timezone
mktime(12, 0, 0, 1, 15, 2024);

// UTC via gmmktime
gmmktime(12, 0, 0, 1, 15, 2024);
// 1705320000

MySQL

-- MySQL: returns seconds since epoch in server timezone
SELECT UNIX_TIMESTAMP('2024-01-15 12:00:00');
-- 1705320000 (if server is UTC)

-- Convert stored DATETIME column to timestamp
SELECT UNIX_TIMESTAMP(created_at) FROM orders;

Timezone Considerations

The same date string in different timezones produces a different Unix timestamp — this is one of the most common sources of confusion in date-to-timestamp conversion.

Consider the string 2024-01-15 12:00:00:

  • Interpreted as UTC: 1705320000
  • Interpreted as EST (UTC-5): 1705338000 — 18000 seconds later

To avoid ambiguity, always specify the timezone explicitly. In ISO 8601, append Z for UTC or an offset such as -05:00 for EST. Storing timestamps internally in UTC and converting to local time only for display is the recommended practice for any application that handles multiple timezones.

For more on epoch time and timezone handling, see the Epoch Converter and Unix Timestamp reference pages.

Get Date from Unix Timestamp

This tool works in both directions. You can convert a calendar date to a Unix timestamp, or paste a Unix timestamp to instantly see the corresponding human-readable date. Simply enter a numeric timestamp in the converter above and the tool will display the result in UTC, your local timezone, and ISO 8601 format — no extra steps required.

Unix timestamps are plain integers counting seconds (or milliseconds) since January 1, 1970 00:00:00 UTC. Because they carry no timezone information, converting them back to a date is unambiguous: the same number always maps to the same moment in time, regardless of where you are in the world. The displayed local time may differ, but the underlying UTC moment never changes.

Looking to convert a Unix timestamp to a date? Use our tool above — enter a timestamp in the first field to instantly see the date. For a dedicated reverse converter with additional output formats, visit our Timestamp to Date page.

Frequently Asked Questions

How do I convert a date to an epoch timestamp?

Use the Date & Time field in the converter above and the epoch value updates instantly. In JavaScript: Math.floor(new Date('2024-01-15T12:00:00Z').getTime() / 1000) returns the UTC epoch timestamp in seconds.

What timezone is used for date to timestamp conversion?

By default, the tool uses your browser local timezone. For UTC conversion, specify the Z suffix in ISO 8601 format, or use calendar.timegm() in Python instead of time.mktime().

How do I convert a date to a timestamp in Excel?

Use the formula =(A1-DATE(1970,1,1))*86400 where A1 contains the date value. This calculates the number of seconds elapsed since the Unix epoch. For text date values, use =(DATEVALUE(A1)-DATE(1970,1,1))*86400.

How do I handle timezone offset in date to timestamp conversion?

Add the offset explicitly in the date string: new Date('2024-01-15T12:00:00-05:00').getTime() / 1000. Always store timestamps in UTC internally to avoid ambiguity across daylight saving time transitions.

Milliseconds or seconds — which should I use?

Use seconds (10-digit) for most server-side use cases, REST APIs, and databases. Use milliseconds (13-digit) for JavaScript applications and high-precision event logging where sub-second accuracy matters.

How do I convert a date string to a Unix timestamp in SQL?

MySQL: UNIX_TIMESTAMP('2024-01-15 12:00:00'). PostgreSQL: EXTRACT(EPOCH FROM TIMESTAMP '2024-01-15 12:00:00'). Both return the number of seconds since the Unix epoch.

What is a negative Unix timestamp?

Negative timestamps represent dates before January 1, 1970 UTC. For example, -86400 corresponds to December 31, 1969 at 00:00:00 UTC. JavaScript, Python, and most modern languages handle negative Unix timestamps correctly with the same conversion formulas.

How to get a date from a Unix timestamp?

Enter the Unix timestamp in the converter above. The tool instantly shows the corresponding date in UTC, your local timezone, and ISO 8601 format. For bulk conversions, use the Batch Convert tab.

Related Tools