Sooner or later a form, an API or a database column asks you for a timestamp, and what you have is a date in your head: a launch at nine thirty on a Monday, a token that should expire on a fixed day. Converting that date into a Unix timestamp sounds like pure arithmetic, but one detail catches people out again and again: the time you pick is read in your local time zone, not in UTC. Get that wrong and your timestamp is off by hours, silently.

This guide shows how to convert a date to a Unix timestamp with the free Unix Timestamp Converter on Ovatly, how the local time zone rule works, and how to check your result so the number you ship is the moment you meant.

Contents

  • Quick answer
  • What the number counts
  • The local time zone rule
  • How to convert a date to a timestamp, step by step
  • Worked example: landing exactly on 1700000000
  • Seconds or milliseconds?
  • Limitations and alternatives
  • Common mistakes
  • FAQs
  • Conclusion

Quick answer

Open the Unix Timestamp Converter, go to the lower half, and pick the date and time you want. The important detail: the picked time is interpreted in your local time zone, and the converter says so on the result, so the same picked time produces a different timestamp on a device in a different zone. If the moment you mean is defined in UTC, convert it to your local wall-clock time before you pick it, or check the result against the converter's UTC line in the other direction.

What the number counts

A Unix timestamp counts the seconds since the Unix epoch: midnight at the start of 1 January 1970 in UTC. Converting a date to a timestamp is counting forward from that moment to yours. Dates before the epoch count backwards and produce negative timestamps.

Because the count is anchored to UTC, a timestamp names one exact moment worldwide. That is the point of the format, and also where the trap sits: the moment is unambiguous, but the date and time you type in are not, until a time zone is chosen for them. The converter chooses your local zone, and tells you it did.

The local time zone rule

The converter's own notes state it plainly: the date-to-timestamp direction interprets the picked time in your local time zone, and says so on the result. Local means your device's zone, the same zone used for the local line when converting a timestamp back into a date, beside the UTC and ISO 8601 lines.

Pick 09:30 on 15 January 2024 on a device set to UTC and you get the timestamp for 09:30 UTC. Pick the same 09:30 on a device five hours ahead of UTC and you get a timestamp 18,000 seconds smaller, because 09:30 there happens five hours earlier in UTC. Neither result is wrong: they are answers about two different moments that share a wall-clock reading. Most off-by-hours bugs in schedules and expiries are born right here.

How to convert a date to a timestamp, step by step

  1. Open the Unix Timestamp Converter.
  2. Decide which time zone your date and time are stated in. Local times can be picked as they are; UTC times must first be converted to what they read as on your local clock.
  3. In the lower half of the converter, pick the date and time, then read the timestamp it returns, noting the on-result reminder that your pick was read as local time.
  4. Sanity-check the result: paste the timestamp into the top half of the converter and read the UTC, ISO and local lines plus the relative description. The UTC line should show the moment you intended.
  5. Check the digit count before using the number elsewhere: 10 digits for seconds, 13 for milliseconds. If the receiving system expects the other unit, convert deliberately.

Worked example: landing exactly on 1700000000

The converter's own example gives a fixed point to aim at: the timestamp 1700000000 is Tuesday, 14 November 2023 at 22:13:20 UTC, with the ISO form 2023-11-14T22:13:20.000Z. In milliseconds the same moment is 1700000000000.

Now run it backwards. On a device set to UTC, pick 14 November 2023, 22:13:20 in the lower half. Because your local zone is UTC, the pick is read as 22:13:20 UTC, and the result is exactly 1700000000. Paste it into the top half to confirm: the UTC line reads Tuesday, 14 November 2023 at 22:13:20, the ISO line 2023-11-14T22:13:20.000Z.

Repeat the pick on a device five hours ahead of UTC and the result is 1699982000, 18,000 seconds less: that device read 22:13:20 as local time, which is 17:13:20 UTC. Same date, same clock reading, different timestamp.

Seconds or milliseconds?

Systems disagree about the unit, so the converter deals in both. Current timestamps in seconds have 10 digits; in milliseconds they have 13. When you paste a timestamp in, the converter auto-detects the unit and shows which one it used: values of 1 trillion or more are treated as milliseconds and smaller values as seconds. You can also force the unit with the selector when you know which you have.

Before you copy the number, check what unit the receiving system expects. A seconds value pasted where milliseconds are expected lands in January 1970; a milliseconds value read as seconds lands tens of thousands of years in the future. Count the digits of your result and compare them with a current timestamp from the same system.

Limitations and alternatives

The local zone rule is the main limitation to plan around. The converter reads your pick in your device zone and labels it, but it cannot know whether the date you were given was stated in UTC, another zone, or yours. That judgement is yours. If the moment matters to the hour, do the round-trip check in step 4 and read the UTC line, not just the local one.

Auto-detection has one edge worth knowing: a millisecond value from before 2001 is small enough to be misread as seconds, so use the unit selector when you are converting old millisecond values and it matters. At the extremes, values beyond the range JavaScript dates support, about 275,000 years either way, are reported as errors rather than converted. For ordinary work (scheduling, expiries, log analysis, test data) none of this bites, and everything runs locally in your browser.

Common mistakes

  • Picking a UTC time as if it were local. If the deadline was given to you in UTC and you pick it unchanged, your timestamp is off by your zone's offset. Convert to your local clock reading first, then verify with the round-trip check.
  • Assuming the same pick gives the same number everywhere. It does not. A colleague in another zone who picks the same date and time gets a different timestamp. Share the timestamp itself, not instructions to pick the same time.
  • Mixing up seconds and milliseconds. Ten digits versus thirteen. A unit mix-up does not produce a slightly wrong time; it produces a date in 1970 or the far future, easy to spot if you look.
  • Trusting auto-detect for old millisecond values. A pre-2001 millisecond timestamp can be read as seconds. Force the unit when the value's age makes the detection ambiguous.
  • Skipping the round-trip check. Pasting your result back and reading the UTC line takes seconds and catches every zone mistake on this list.

FAQs

Is my timestamp in seconds or milliseconds? Current timestamps in seconds have 10 digits; in milliseconds they have 13. The converter auto-detects the unit and shows which one it used, treating values of 1 trillion or more as milliseconds and smaller values as seconds. If you know which unit you need, force it with the unit selector.

What is the Unix epoch? Midnight at the start of 1 January 1970 in UTC. A Unix timestamp counts the seconds, or milliseconds, since that moment, so converting a date means counting forward from the epoch to that date.

Why did the same date and time give a different timestamp on another computer? Because the date-to-timestamp direction interprets the picked time in the local time zone of the device doing the conversion. The same wall-clock time in two different zones is two different moments, so the timestamps differ by the gap between the zones.

Why does the same timestamp show a different hour for me? The moment is identical; only its display changes with time zone. UTC and ISO values are zone-free, while the local line applies your device's zone.

What happens with a date far in the future or the past? Values beyond the range JavaScript dates support, about 275,000 years either way, are reported as errors rather than converted. Ordinary dates, including ones well before 1970, convert normally and give negative timestamps for moments before the epoch.

Conclusion

Converting a date to a Unix timestamp is one pick and one read, as long as you respect the zone your pick is read in. Pick deliberately, note that the Unix Timestamp Converter reads the time as local, and round-trip the result to check the UTC line before you rely on it. If your work is more about matching text than converting time, the companion guide Regex Flags Explained: g, i, m, s and u covers the flags that change what a pattern does, and the Developer Tools guides cover the rest of the category.