How to Convert Unix Timestamps in Excel, Python, JavaScript and SQL
A practical guide explains Unix timestamp conversion across Excel, Python, JavaScript and SQL, with safeguards for seconds versus milliseconds, time zones and the Year 2038 problem.
Unix time is the number of seconds elapsed since 00:00:00 UTC on January 1, 1970. The example timestamp 1764288000 corresponds to 2025-11-28 00:00:00 UTC, while the same instant appears as 08:00 in UTC+8.
In Excel, seconds-based timestamps can be converted with =A1/86400 + DATE(1970,1,1), while millisecond values use =A1/86400000 + DATE(1970,1,1). The result must be formatted as a date and time; Excel does not apply time zones automatically.
Python can use datetime.fromtimestamp(ts, tz=timezone.utc), while JavaScript requires multiplying a seconds-based value by 1000 before passing it to Date. Current second-based values generally have 10 digits and millisecond values 13 digits; values above 1e11 can be treated as milliseconds by the guide’s heuristic.
MySQL and PostgreSQL provide Unix-time conversion functions, but their displayed results depend on session or client time-zone settings. The guide also warns that signed 32-bit Unix time reaches its limit at 03:14:07 UTC on January 19, 2038, making 64-bit storage preferable for long-lived systems.