Unix time is <i>not</i> unambiguous. It is linked to UTC, so occasionally there are leap seconds, and there isn’t a standard format for these (two seconds == one second, or skip a second)[1]. TAI is a better format, but turns out the common TAI libraries just code the TAI offset from Unix time.<p>[1] <a href="https://geometrian.com/programming/reference/timestds/index.php" rel="nofollow">https://geometrian.com/programming/reference/timestds/index....</a>
There's also RFC 3339[1] which is, IMO, a bit better. The RFC is readily readable, unlike an ISO standard, and the RFC is — mostly — more restrictive.<p>ISO is fun up until you have to parse "2022-089". Yes, that's a valid ISO date. And it's in March. (And yes, I've seen that used in the wild, though I don't know why anyone would ever choose that format.)<p>[1]: <a href="https://datatracker.ietf.org/doc/html/rfc3339" rel="nofollow">https://datatracker.ietf.org/doc/html/rfc3339</a>
JSON needs to have a timestamp type. Parsers should automatically convert them to/from native language timestamp objects. Human readable is preferred, but really the critical aspect is to make the JSON self-describing. If timestamps are self-describing, any smart editor can display them properly.
> <i>A sample of 20 APIs yielded nearly a 50/50 split.</i><p>Is it still a 50/50 split today? I suspect ISO 8601 has grown to become the standard.
I’m quite surprised that Unix time is so common. My anecdotal experience with dozens of public and internal APIs over 20 years of development is that the most common format is local time followed by ISO. I actually have almost never seen Unix time.
> "Unix time is completely unambiguous."<p>Looks like someone hasn't had to deal with data from multiple different time zones processed by code written by different developers over several years!<p>Unix time could be unambiguous, but it is not in practice. If it has been unambiguous for you, congratulations!<p>Use ISO style dates if you don't want to spend the rest of your life explaining what a date actually means.