The Unix epoch
The starting point is 1970-01-01 at 00:00:00 UTC, commonly called the Unix epoch. A positive timestamp counts forward from that instant; a negative timestamp represents an earlier instant.
Seconds or milliseconds?
Many systems store whole seconds, while JavaScript commonly works in milliseconds. A contemporary seconds value usually contains 10 digits, while a milliseconds value usually contains 13. Multiplying seconds by 1,000 produces milliseconds; dividing milliseconds by 1,000 produces seconds.
A timestamp does not contain a display time zone
The number identifies an instant. A viewer chooses a zone when turning that number into a calendar date and clock time. The same timestamp can therefore appear as Monday afternoon in one city and Tuesday morning in another.
Common mistakes
- Treating a millisecond value as seconds, which creates a date far in the future.
- Assuming the number describes the computer's local time rather than a universal instant.
- Dropping fractional seconds when event order requires millisecond precision.