Quick reference
| Topic | Value | Use |
|---|---|---|
| Seconds | 10 digits | Unix logs, cron, many APIs |
| Milliseconds | 13 digits | JavaScript Date.now(), browser events |
| Microseconds | 16 digits | databases and tracing |
| Nanoseconds | 19 digits | high precision telemetry |
Practical notes
A 10-digit value is usually Unix seconds, while a 13-digit value is usually Unix milliseconds. This is the fastest first check when an API returns a date that appears decades off.
JavaScript Date, browser performance logs, and many frontend events use milliseconds. Many databases, queues, and infrastructure logs may use seconds, microseconds, or nanoseconds, so field names should include the unit.
| 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. |