Skip to content

Date to Timestamp

Convert a date/time to a Unix timestamp.

Date (YYYY-MM-DD HH:mm:ss)
Output

No result

About Date to Timestamp

Date to Timestamp converts a calendar date and time into the number of seconds and milliseconds elapsed since the Unix epoch of 1 January 1970. It accepts the widely used form of year, month, day, hour, minute and second separated by a space, and returns both precisions so you can use whichever the target system expects.

The time zone is the detail that decides whether the answer is right. A value with no zone marker is interpreted as local time on your machine, because that is what the underlying date parser does with an offset-free string. Appending a Z to the input marks it as UTC instead, which is usually what you want when the date came from a database or a log and was stored in universal time.

Input that cannot be parsed is reported as invalid rather than being coerced into a nearby date, because a silently adjusted timestamp is far harder to notice than a rejected one. Dates before 1970 produce negative values, which is correct for the epoch-based convention.

How to use Date to Timestamp

  1. 1 Type the date and time in year-month-day order, with the time after a space.
  2. 2 Add a trailing Z if the value is meant to be UTC rather than local time.
  3. 3 Read the seconds value for most storage formats, or the milliseconds value for JavaScript.

Frequently asked questions

Is my date treated as local time or UTC?

Local time, unless you mark it otherwise. Adding a Z to the end of the input switches the reading to UTC, which is the form you want when the value originated from a database that stores timestamps in universal time.

Why did my date come back as invalid?

The accepted form is year, month, day, then a time, with the parts separated consistently. Ambiguous conventions such as day-first ordering or month names are not interpreted, precisely because guessing between two readings of the same string is how a date ends up a month out.

Can I convert timestamps back into dates?

Yes, in the other direction: the Timestamp to Date tool takes a number and a unit and returns the local, ISO and UTC renderings, so the two tools form a complete round trip.

What about dates before 1970?

They produce negative timestamps, which is the correct convention rather than an error. Some strict validators reject negative values, however, so check the receiving system if you are working with historical dates.

Free, online, and private

Free to use

Date to Timestamp is completely free. There is no account to create, no login, and no hidden charge or usage limit.

Runs online in your browser

It is a free online tool that runs entirely in your browser. Nothing to download or install — open the page and start using it right away.

Your data stays private

All processing happens locally on your device. Your input is never uploaded, stored, or tracked, so it never leaves your browser.

How Date to Timestamp behaves in detail

These are the specifics of this implementation — the exact ranges, defaults and fixed settings you are working with.

Parameter Value
Input field one text box, empty by default — the expected shape is only stated in the label and the error text
Parsing the first space is replaced with T, then the string is handed to the browser Date parser
Output rows two: Seconds (floored with Math.floor) and Milliseconds
Failure line the exact text "Invalid date. Use YYYY-MM-DD HH:mm:ss"

Compiled from the implementation of this tool and checked against it by itoolnet.

What Date to Timestamp does not do

Knowing the edges of a tool saves more time than another list of its features. These are the cases where it will not do what you might expect.

  • A date on its own is read as UTC while a date with a time is read as local, because the string goes straight to the platform parser — the identical input yields different numbers on machines set to different zones.
  • Out-of-range days are not rejected: the parser rolls them forward, so 2024-02-31T00:00:00 returns the timestamp for 2 March 2024 and nothing in the output indicates that the date was quietly substituted.
  • Only the first space is turned into a T, so a 12-hour input such as 2024-01-01 12:00:00 PM keeps its second space and fails to parse, landing on the generic invalid-date line rather than being interpreted.

Tested and documented by itoolnet, the team that builds and maintains this site.

Share & embed this tool

Writing a guide or article? You are welcome to link to Date to Timestamp with the snippet below. It is free, runs entirely in your browser, and needs no signup.