Unix Timestamp Conversion: Debug Dates Without Guessing Time Zones
Date bugs often start with a timestamp that looks correct but is interpreted in the wrong unit or time zone. Seconds, milliseconds, UTC, local time, and daylight saving changes can all shift a result.
The first question is whether the timestamp is in seconds or milliseconds. A 10-digit value usually represents seconds, while a 13-digit value usually represents milliseconds, but it is still worth confirming with the API documentation.
Identify the unit before converting
Convert the value both ways if you are unsure. If one result lands decades away from the expected date, the other unit is probably correct.
- Check whether the API field says timestamp, epoch, created_at, or expires_at.
- Count digits before assuming seconds or milliseconds.
- Compare against a known event time from logs or the UI.
- Keep UTC and local display times visible during debugging.
Time zones change the story
Unix timestamps represent a point in time, but humans read dates in local time. A date that appears to be off by one day may be correct in UTC and different in the user's time zone.
- Use UTC for storage and comparisons.
- Use local time only for display when appropriate.
- Check daylight saving boundaries for scheduled tasks.
- Avoid manually adding offsets in code unless the format requires it.
Debug with the raw value
When a date looks wrong, copy the raw timestamp into a converter before changing code. Compare the UTC result, local result, and expected business event time.
Timestamp debugging is faster when you separate three questions: what unit is this, what time zone is used, and where is it displayed.
Open Unix Timestamp Converter →