How can you tell Unix seconds from milliseconds?
Distinguish 10- and 13-digit values, time zones, and ISO 8601 output.
For current dates, 10-digit Unix values are usually seconds and 13-digit values are milliseconds. Digit count is a practical clue; for certainty, convert with both units and check which result falls in a reasonable date range.
What changed in this update?
Unit detection and time-zone checks were combined.
What happens when the unit is wrong?
Reading milliseconds as seconds can produce a far-future or invalid date. Reading seconds as milliseconds produces a date near 1970.
Where does the time zone apply?
The Unix value represents elapsed time from the UTC epoch. A time zone is applied only when producing a human-readable local display.
What should an API contract specify?
Name the field with the unit (`createdAtMs`) or document `seconds` versus `milliseconds` explicitly. Preserve the `Z` suffix when an ISO 8601 value is UTC.
Frequently asked questions
Can a timestamp be negative?
Yes. Negative values can represent dates before 1970.
Does Unix time count leap seconds?
The common Unix time model does not represent leap seconds as separate counted seconds.