Current timestamp and conversion in your language
How to get the current Unix time in seconds and convert a timestamp to a UTC date.
| Language | Current timestamp | Timestamp to date |
|---|---|---|
| JavaScript | | |
| Python | | |
| Bash Linux (GNU date) | | |
| Bash macOS and BSD | | |
| PostgreSQL floor() truncates: without it, the cast to bigint rounds | | |
| MySQL FROM_UNIXTIME uses the session time zone; here it is set to UTC | | |
The examples convert 1768175999, which is 2026-01-11 23:59:59 UTC.
About this tool
Unix time (also called epoch time, POSIX time or Linux timestamp) is the number of seconds elapsed since 1 January 1970 at 00:00:00 UTC, the so-called epoch. It does not count leap seconds: every day lasts exactly 86,400 seconds, so subtracting two timestamps gives a duration. It is the format used by Linux, most APIs, databases and logs.
The number of digits tells you the unit. A 10-digit timestamp is in seconds (date +%s on Linux, time() in PHP); a 13-digit one is in milliseconds, what Date.now() returns in JavaScript and System.currentTimeMillis() in Java; a 16-digit one is in microseconds, common in traces and some databases; and a 19-digit one is in nanoseconds, like time.time_ns() in Python. The converter detects the unit from the number of digits and lets you change it if the detection is wrong.
For example, the timestamp 1768175999 is 2026-01-11 23:59:59 UTC, the last second of 11 January 2026 in UTC, which in Madrid (UTC+1 in winter) is already 12 January at 00:59:59. The same instant in milliseconds is 1768175999000.
Systems that store Unix time in a signed 32-bit integer overflow on 19 January 2038 at 03:14:07 UTC: this is the year 2038 problem, which does not affect 64-bit systems (with an unsigned 32-bit integer the limit is 2106). Below the tool you will find how to get the current timestamp and convert it to a date in JavaScript, Python, Bash, PostgreSQL and MySQL.
Articles published on the blog
