Unix Timestamp Converter

Timestamps to dates, and it says how it read them.

Timestamps to dates, and it says how it read them.

How to use it

  1. Paste either one. A timestamp in digits, or a date as YYYY-MM-DD. The direction follows from what you typed.
  2. Check how it was read. The first row says whether it was taken as seconds or milliseconds.
  3. Copy what you need. ISO 8601, the readable date, and both timestamp forms.

When you would use this

A Unix timestamp is the number of seconds since the start of 1970, which is simple until you are handed one and cannot tell whether it is in seconds or milliseconds. Getting that wrong puts the answer out by a factor of a thousand, which is roughly fifty years, and it is easy to miss because both answers are plausible looking dates. This decides by magnitude, since a seconds timestamp for any realistic date is ten digits and the milliseconds form is thirteen, and then it says which one it used. That is the part most converters leave out. Everything is reported in UTC and labelled. A timestamp is a moment, not a local time, and quietly converting it into whatever zone your machine happens to be in is how two people looking at the same value end up disagreeing. Negative timestamps work, because dates before 1970 are perfectly ordinary and rejecting them is a bug rather than a policy. It also converts the other way: give it a date and it returns the timestamp for UTC midnight.

Questions

How does it know seconds from milliseconds?
By magnitude. A seconds timestamp for any date between 1973 and the year 5138 is ten digits, and the milliseconds equivalent is thirteen. Guessing wrong puts the answer out by a factor of a thousand, which is about fifty years, so the tool states which it used rather than leaving you to spot it.
What time zone are the results in?
UTC throughout, and it is labelled as such. A timestamp is a moment rather than a local time, and converting it into your own zone silently is how two people comparing the same timestamp end up with different answers.
Do negative timestamps work?
Yes. A negative value is a moment before 1 January 1970, so it converts the same way. Plenty of tools reject them, which is wrong: dates before the epoch are perfectly ordinary.