Skip to content
unixframe.com

One direction · date in, timestamp out

Date to Timestamp

Pick a date and time and get the unix timestamp for it. Choose whether your input is read in your local zone or UTC, then copy the value in seconds or milliseconds.

One job only: date and time to unix timestamp, plus the ISO 8601 and UTC forms of the same instant. Everything is computed in your browser.

Date and time

Read the entered time as

pick a date and time

Jump to

Timestamp

Waiting for a complete date — unix seconds, milliseconds, UTC and ISO 8601 appear here.

Need to go the other way?Convert a timestamp to a date →

How a date becomes a timestamp

A unix timestamp is the number of seconds between the Unix epoch — 00:00:00 UTC on 1 January 1970 — and the instant you are describing. Converting a date to epoch time is that subtraction, which is why the answer is a plain integer with no timezone attached.

The timezone toggle matters before the conversion, not after. “2026-09-16 20:30” is an ambiguous wall-clock reading until you say which zone it was written in. Local reads it in your browser’s zone, daylight saving included; UTC reads it as UTC. Switch between the two and the resulting timestamp moves by your offset.

Seconds or milliseconds depends on what consumes the value, and both are given above. For the longer explanation and the FAQ, see the unix timestamp converter homepage.

How to convert a date to a timestamp

  1. Pick the date and time. Enter the date and time in the field above, or press Now to fill in the current moment. Seconds are part of the field, so you can be exact.
  2. Choose the zone it was written in. Local reads the entered time in your browser's time zone, daylight saving included. UTC reads exactly the same digits as UTC. This choice changes the resulting timestamp.
  3. Copy the timestamp. The Unix seconds value appears first, with milliseconds, UTC and ISO 8601 below it. Each has its own copy button.

Converting a date to a timestamp in code

The same conversion in the runtimes that usually need it. Each of these returns epoch seconds; multiply by 1000 for milliseconds.

JavaScript
Math.floor(Date.parse("2026-09-17T20:30:00Z") / 1000)Append Z to read the string as UTC rather than local time.
Python
int(datetime(2026, 9, 17, 20, 30, tzinfo=timezone.utc).timestamp())
PHP
strtotime('2026-09-17 20:30:00 UTC')
Go
time.Date(2026, 9, 17, 20, 30, 0, 0, time.UTC).Unix()
Java
Instant.parse("2026-09-17T20:30:00Z").getEpochSecond()
C#
new DateTimeOffset(dt, TimeSpan.Zero).ToUnixTimeSeconds()
Ruby
Time.utc(2026, 9, 17, 20, 30).to_i
Bash (GNU)
date -u -d "2026-09-17 20:30:00" +%s
PostgreSQL
SELECT EXTRACT(EPOCH FROM TIMESTAMPTZ '2026-09-17 20:30:00Z');
MySQL
SELECT UNIX_TIMESTAMP('2026-09-17 20:30:00');
Excel / Sheets
=(A1-DATE(1970,1,1))*86400

The zone is the thing to get right in every one of them — the same wall-clock string produces a different timestamp depending on how it is read, which is the same choice the Local / UTC toggle above makes. Going the other way is on the timestamp to date converter.

Frequently asked questions

How do I convert a date to a Unix timestamp?

Pick the date and time above, choose whether it should be read in your local zone or UTC, and the epoch value appears in seconds, with milliseconds, UTC and ISO 8601 beside it.

Does the Local or UTC setting change the answer?

Yes, and that is the point. A wall-clock reading like 2026-09-16 20:30 names a different instant depending on the zone it was written in, so switching between Local and UTC shifts the resulting timestamp by your current UTC offset.

Should I use seconds or milliseconds?

Use whatever consumes the value. Most Unix tooling, Python, Go and PostgreSQL expect 10-digit seconds, while JavaScript, Java and many log pipelines expect 13-digit milliseconds. Both are given above.

Is daylight saving time handled?

Yes. In Local mode the date is read through your browser's time zone, which applies whatever DST offset was in force on that date — not today's offset. Converting a summer date in winter still gives the correct timestamp.

Other tools

Dedicated pages when you need one direction, one answer, or one format.