Date to Unix timestamp
Converts a date into a Unix timestamp — the number of seconds since 1 January 1970 UTC. Paste ISO 8601, `2024-01-01 12:00:00`, or the string a JavaScript Date prints.
How to use the date to unix timestamp
A Unix timestamp is a count of seconds from the epoch, 1 January 1970 UTC, and it carries no time zone at all. That is the point: an instant has one timestamp everywhere on earth, and the zone is applied only when it is displayed. Converting a date to a timestamp therefore needs to know which zone the date was written in, and a date with no zone marker is ambiguous by up to 26 hours.
This reads an unmarked date as UTC rather than as your local time. That is a deliberate choice and worth knowing, because JavaScript does the opposite for the space-separated form: new Date("2024-01-01 12:00") is local while new Date("2024-01-01T12:00Z") is UTC, and the two differ by your offset. Reading everything as UTC means the ISO form and the space form agree here, which is not true in a browser console.
The famous limit is 03:14:07 UTC on 19 January 2038, when a signed 32-bit timestamp overflows and wraps to 1901. Modern systems use 64 bits and are safe for about 292 billion years, but embedded devices, old file formats and some database columns still use 32 bits — and unlike Y2K the failure is silent, producing a date in the past rather than an error.
Questions
UTC, including the space-separated form. JavaScript reads that form as local, so the two can differ by your offset.