Quick reference
| Topic | Value | Use |
|---|---|---|
| What is Unix time? | Seconds since 1970-01-01 00:00:00 UTC. | Use UTC for storage. |
| Seconds or milliseconds? | Check digit length and API docs. | JavaScript often uses milliseconds. |
| Does timezone change the timestamp? | The instant does not change; display time does. | Convert at the edge. |
Practical notes
Unix time represents an instant, not a calendar display. The same timestamp can appear as different local clock times in Shanghai, New York, or London.
Most timestamp bugs come from mixing units, converting twice, or storing local time without an offset. Keep the stored value UTC and convert at the UI edge.
| Check | Why it matters |
|---|---|
| Unit label | Field names such as created_at_ms or expires_at_s prevent seconds/milliseconds mixups. |
| Timezone | Store UTC or an explicit offset. Avoid server-local assumptions in jobs, logs, and API tests. |
| Round trip | Convert timestamp to ISO and back before shipping a parser or migration script. |