Turn epoch seconds or milliseconds into a readable date, convert a date back into a timestamp, and measure how long ago something happened.
A UNIX timestamp counts seconds since 1970-01-01T00:00:00Z. Ten digits means seconds, thirteen means milliseconds, and neither is readable at a glance — which is why a log line with a raw epoch value usually means opening another tab.
The two questions worth asking about a timestamp are what date it represents and how long ago that was. The second is the one that tells you whether a token expired an hour ago or a month ago, and it is a subtraction rather than a lookup.
A bare ten-digit integer is read as epoch seconds and shown in your local timezone.
Thirteen digits is the millisecond form of the same instant.
How long ago that timestamp was — the question behind most stale-data bugs.
Thirty days out, output as a machine-readable string for a config file.
The number of seconds elapsed since the UNIX epoch, 1970-01-01T00:00:00 UTC, ignoring leap seconds. It is timezone-independent, which is why systems store it instead of a formatted date.
Count the digits. Ten digits is seconds and covers dates up to 2286; thirteen digits is milliseconds. If a date converts to 1970, you almost certainly passed milliseconds to something expecting seconds.
No — it always refers to an instant in UTC. The timezone only appears when you format it for display, which is why the same timestamp shows different wall-clock times to users in different places.
A signed 32-bit integer holding epoch seconds overflows on 19 January 2038. Systems using 64-bit timestamps are unaffected, but legacy code storing time in a 32-bit int is not.