Milliseconds to Unix Seconds Converter
JavaScript's `Date.now()` returns milliseconds, but most APIs and databases use seconds. Divide by 1000 (and floor the result) to convert.
Example: 1706745600000
| Unix (seconds) | 1706745600000 |
|---|---|
| Unix (milliseconds) | 1706745600000000 |
| ISO 8601 (UTC) | 56054-08-13T00:00:00Z |
| RFC 2822 | Thu, 13 Aug 56054 00:00:00 GMT |
| Human Readable | August 13, 56054 12:00:00 AM UTC |
Common Pitfall
Note: Don't just divide - also `Math.floor()` or `parseInt()` the result. `1706745600999 / 1000` is `1706745600.999`, which most APIs will reject as a non-integer timestamp.
Code Examples
JavaScript
Math.floor(1706745600000 / 1000)
Python
1706745600000 // 1000
PHP
intdiv(1706745600000, 1000);
Go
int64(1706745600000 / 1000)
SQL (PostgreSQL)
SELECT (1706745600000 / 1000)::BIGINT;