Epoch Converter
Convert between Unix epoch time (seconds, milliseconds, microseconds) and human-readable date strings instantly.
Language snippets for current epoch
| JavaScript (s) | Math.floor(Date.now() / 1000) | |
| JavaScript (ms) | Date.now() | |
| PHP | time() | |
| Python | import time; int(time.time()) | |
| Bash | date +%s | |
| MySQL | SELECT UNIX_TIMESTAMP() | |
| PostgreSQL | SELECT EXTRACT(EPOCH FROM NOW()) | |
| Go | time.Now().Unix() | |
| Ruby | Time.now.to_i |
Frequently asked questions
Seconds vs milliseconds vs microseconds?
Unix timestamps are commonly expressed in seconds (10 digits), milliseconds (13 digits, multiply seconds by 1000), or microseconds (16 digits). JavaScript's Date.now() returns milliseconds. PHP's time() returns seconds.
How do I get the current epoch time in different languages?
JavaScript: Date.now() (ms) or Math.floor(Date.now()/1000) (s). PHP: time(). Python: import time; time.time(). Bash: date +%s. SQL: UNIX_TIMESTAMP() (MySQL), extract(epoch from now()) (PostgreSQL).