The bug report says the release went out on the wrong day. The database says the 14th; the announcement said the 15th. Nobody typed the date wrong. What happened is quieter: a midnight in one time zone was read as a different calendar day in another, or a value in one unit was treated as a value in another.

Off-by-one-day bugs are the classic timestamp conversion mistake, and they survive code review because every step looks reasonable. This guide walks through the three causes, using the free Unix Timestamp Converter on Ovatly to make each visible.

Contents

  • Quick answer
  • A timestamp has no calendar day of its own
  • Mistake 1: local midnight is not UTC midnight
  • Mistake 2: date-only values get read as UTC
  • Mistake 3: the wrong unit moves the moment itself
  • How to pin down a wrong date, step by step
  • Worked example: the midnight that moved
  • Limitations and honest warnings
  • Common mistakes
  • FAQs
  • Conclusion

Quick answer

Most off-by-one-day results come from one of three causes. First, the Unix Timestamp Converter interprets a date and time you pick in your local time zone, so your midnight is not UTC midnight. Second, a date-only value like 2023-11-15 is commonly read as midnight UTC, still the previous evening in zones behind UTC. Third, seconds and milliseconds get swapped, which moves the moment itself. The converter shows UTC, ISO 8601 and your local time together, which makes these shifts visible instead of silent.

A timestamp has no calendar day of its own

A Unix timestamp counts the seconds (or milliseconds) since midnight at the start of 1 January 1970 in UTC. It names one single moment, not a day, because a day is a local idea: the same moment is already Tuesday in one part of the world and still Monday in another.

That is why the converter shows three lines for every value: UTC, ISO 8601 and your local time, plus a relative description like "3 days ago". The first two are zone-free; the local line applies your device's zone. When a date looks wrong by exactly one day, the timestamp is almost never wrong: a display has been mistaken for the moment itself.

Mistake 1: local midnight is not UTC midnight

When you pick a date and time in the converter's lower half, the picked time is interpreted in your local time zone, as the result states. Pick midnight at the start of 15 November 2023 on a device set to UTC+5 and you have chosen the moment that is 19:00 on 14 November in UTC: timestamp 1699988400.

Hand that timestamp to a server or report that renders it in UTC and it shows 14 November, 19:00: your event, which you meant as "the 15th", displays on the 14th. Nothing malfunctioned. Two midnights, yours and UTC's, are five hours apart, and a locally picked date carries your zone inside it.

Mistake 2: date-only values get read as UTC

The mirror-image mistake starts with a value that has no time at all. A date-only string such as 2023-11-15 must become a moment, and the common convention is midnight UTC: 1700006400, 15 November 2023 at 00:00:00 UTC.

Display that moment anywhere behind UTC and it is not the 15th yet. In a UTC-5 zone it renders as 14 November 2023 at 19:00, the previous evening, on the previous calendar day. This is the version that shows up in due dates, birthdays and expiry dates: the stored value is exactly what was agreed, yet the user sees a date one day earlier than the one they entered.

Mistake 3: the wrong unit moves the moment itself

Zone mistakes shift a date by hours; unit mistakes shift it by decades or millennia. The converter auto-detects the unit: values of 1 trillion or more are treated as milliseconds, smaller values as seconds. Current timestamps in seconds have 10 digits; in milliseconds they have 13. Feed the seconds value 1700000000 to something that reads it as milliseconds and you get 20 January 1970. Feed the millisecond value 1700000000000 to something that reads it as seconds and you land tens of thousands of years in the future.

The subtle case sits in the converter's own notes: a millisecond value from before 2001 is smaller than 1 trillion, so auto-detection reads it as seconds. The millisecond timestamp for 1 January 2000, 946684800000, read as seconds points tens of thousands of years away. When a value matters, force the unit with the selector.

How to pin down a wrong date, step by step

  1. Open the Unix Timestamp Converter and paste the timestamp that produced the wrong date, or press Use current time to start from a known moment.
  2. Leave the unit on Auto-detect first, and check which unit the converter says it used. If the value is old or the unit is in doubt, force seconds or milliseconds with the selector and compare.
  3. Read the UTC, ISO and local lines together. If the UTC line shows the day you expected and the local line does not, you have a display-zone issue, not bad data.
  4. To test the other direction, pick the date and time in the lower half and read its timestamp. Compare it with the stored value: a few hours of difference points at zone handling; a wildly different value points at units.

Worked example: the midnight that moved

Start with the converter's own example. The timestamp 1700000000 converts to Tuesday, 14 November 2023 at 22:13:20 UTC, ISO 2023-11-14T22:13:20.000Z. In milliseconds the same moment is 1700000000000, detected automatically from its length.

Now the buggy version. On a device in UTC+5, someone picks the start of 15 November 2023 for a launch. The converter interprets the picked time locally and returns 1699988400. Convert that back: the local line shows 15 November at midnight, exactly what was picked, while the UTC line shows 14 November 2023 at 19:00:00. A schedule rendered in UTC announces the launch on the 14th. The fix is not a different timestamp; it is agreeing which zone's midnight the date meant.

Limitations and honest warnings

The converter reports what a value means, not what it was supposed to mean. If a timestamp was created in the wrong zone or unit upstream, the conversion faithfully shows the wrong moment, and only someone who knows the intended date can spot the shift.

Auto-detection is a heuristic based on size: values of 1 trillion or more are read as milliseconds, so a pre-2001 millisecond value can be misread. The unit selector exists for exactly that case. At the extremes, values beyond the range JavaScript dates support, about 275,000 years either way, are reported as errors rather than converted. And the relative description ("3 days ago") is a reading aid, not a precision instrument; debug with the UTC, ISO and local lines, which are exact.

Common mistakes

  • Picking a date locally and reading the result in UTC. The picked time is interpreted in your local zone, and a local midnight is an evening in UTC for zones ahead of it.
  • Storing a date-only value and displaying it behind UTC. Midnight UTC is the previous evening, and the previous day, in those zones.
  • Trusting auto-detection for old millisecond values. Anything in milliseconds from before 2001 falls under the 1 trillion line and gets read as seconds.
  • Assuming the timestamp is corrupt. A one-day shift with a plausible time of day is almost always a zone display issue; check the UTC and local lines before touching the data.

FAQs

Why does my converted date land one day early? Usually because two different midnights are involved. The converter interprets a picked date and time in your local time zone, while a date-only value is often read as midnight UTC. Displayed in another zone, that moment can fall on the previous calendar day.

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.

Is this seconds or milliseconds? How can I tell? Current timestamps in seconds have 10 digits; in milliseconds they have 13. If your number has 13 digits it is almost certainly milliseconds. The converter auto-detects this and shows which unit it used.

Why did a millisecond timestamp from before 2001 convert wrongly? Auto-detection treats values of 1 trillion or more as milliseconds and smaller values as seconds. A millisecond value from before 2001 falls below that line, so force the unit with the selector when it matters.

What happens if a timestamp is far outside the normal range? Values beyond the range JavaScript dates support, about 275,000 years either way, are reported as errors instead of producing a date.

Conclusion

An off-by-one-day bug is rarely a broken timestamp. It is a local midnight read as a UTC one, a date-only value displayed behind UTC, or a unit that quietly changed the moment. The Unix Timestamp Converter puts the UTC, ISO and local readings side by side so you can see which of the three you are dealing with. Unit confusion has a second home in encoded data, where an undecodable string is often a format problem, not a corrupt one; How to Encode Text and Files to Base64 covers that side honestly, including what a text tool cannot do. For more tools like these, see the Developer Tools guide archive.