DateTime and Timestamp Converter
Dates to Unix timestamps and back, with timezones.
About DateTime and Timestamp Converter
Date Time to Timestamp Converter
A Unix timestamp counts the seconds since 00:00:00 UTC on January 1, 1970 (the Unix epoch). 1700000000, for example, is 2023-11-14 22:13:20 UTC. This tool converts in both directions:
- datetime_to_timestamp: enter a date as
YYYY-MM-DD HH:MM:SS, such as2025-03-01 09:30:00. Leave the field empty to get the current timestamp. - timestamp_to_datetime: enter a timestamp in seconds and get the date and time back.
The time zone field takes an IANA name such as Europe/London, America/New_York or Asia/Tokyo. It defaults to UTC. The tool reads the date you enter as local time in that zone, and shows converted dates in that zone.
Seconds or Milliseconds?
Unix systems, PHP and Python's time.time() use seconds, and today's values have 10 digits. JavaScript's Date.now() and Java's System.currentTimeMillis() return milliseconds, which have 13 digits. Divide a millisecond value by 1000 before you paste it here, or the result lands tens of thousands of years in the future.
Converting in Code
- JavaScript:
Math.floor(new Date('2025-03-01T09:30:00Z').getTime() / 1000) - Python:
int(datetime(2025, 3, 1, 9, 30, tzinfo=timezone.utc).timestamp()) - Shell (GNU date):
date -d '2025-03-01 09:30:00 UTC' +%s, and back withdate -u -d @1740821400
Time Zones and Daylight Saving
A timestamp has no time zone. It marks one instant, and you pick the zone when you display it. Store UTC timestamps in databases and logs, and convert to the reader's zone only when you show them.
Daylight saving time creates edge cases. In zones that move clocks forward, some local times never happen (02:30 on the spring-forward night in New York). When clocks go back, an hour repeats, so one local time maps to two timestamps. If you convert times around those dates, check the result.
The Year 2038 Problem
Systems that store timestamps as signed 32-bit integers overflow at 03:14:07 UTC on January 19, 2038. Modern 64-bit systems don't have this limit, but old embedded devices and some file formats still do.