Unix timestamp and time zones: one number, many clocks
By TechCompare · Updated · How we check
A Unix timestamp has no zone attached, so 1780511400 points to one instant for every reader. Show it in a named zone such as Asia/Kolkata, and the library picks the right offset for each date.
1780511400 is 18:30:00 UTC on June 3, 2026. New York, Amsterdam and Kolkata each show their own wall time for that moment, but the number stays 1780511400 in all of them. Changing the zone changes the clock, never the count. The rest of this page shows the clocks, the code, and where dates go wrong.
How this is calculated
The same moment on four clocks:
- UTC: 18:30:00 on Wednesday, June 3, 2026
- New York: 14:30:00 on Wednesday, June 3, 2026, offset UTC-4
- Amsterdam: 20:30:00 on Wednesday, June 3, 2026, offset UTC+2
- Kolkata: 00:00:00 on Thursday, June 4, 2026, offset UTC+5:30
The Z at the end of 2026-06-03T18:30:00.000Z means UTC. A string can also end in an offset such as +02:00, which names the same moment on a different clock. A string with neither leaves the reader to guess the zone. The ISO 8601 vs Unix page compares the two formats, so this page sticks to the zone part.
A zone's offset isn't always fixed. New York uses UTC-5 on January 1, 2026 and UTC-4 on June 3, 2026. Amsterdam changes too: UTC+1 on January 1, 2026 and UTC+2 on June 3, 2026. A zone that changes its offset can't be covered by one fixed number, so pick the zone by name. The IANA Time Zone Database records the history of local time for many places, and a name like America/New_York lets the library pick the offset for each date. Kolkata's offset is UTC+5:30, so adding a whole number of hours to UTC gets it wrong.
JavaScript's toLocaleString returns a formatted string, and Python's fromtimestamp returns a datetime object. Both snippets show the Kolkata wall clock for 1780511400. Python's second argument sets the zone. Without it, the result is a datetime with no zone attached, in the machine's local time.
new Date(1780511400000).toLocaleString("en-US", { timeZone: "Asia/Kolkata" })
// Kolkata clock: 00:00:00 on June 4, 2026from datetime import datetime
from zoneinfo import ZoneInfo
kolkata = datetime.fromtimestamp(1780511400, ZoneInfo("Asia/Kolkata"))
print(kolkata) # Kolkata clock: 00:00:00 on June 4, 2026Both snippets start from the same number and give the same instant, just on Kolkata's clock.
Verdict
These five rules keep the stored number and the shown clock apart:
- Store timestamps in UTC (or ISO strings ending in Z), never local time strings.
- Keep each user's zone as an IANA name like
Europe/Amsterdam, not as a fixed offset. - Convert only when you show a time, and do the math on the number.
- Never fix a zone by adding hours by hand.
- Test one winter date and one summer date, since some zones change their offset between them.
A meeting at 9:00 local time next year has no timestamp yet. The zone's rules decide which moment the local time names, so store the local date, the time and the zone name, and compute the timestamp when you need it. That keeps the meeting in the terms people agreed on.
More Timestamp scenarios
Related guides
Frequently asked questions
Is a Unix timestamp in UTC?
fromtimestamp() converts to the machine's local time when you leave out tz, as the Python datetime docs explain.Why does the same timestamp show a different date in Kolkata?
Why is my timestamp an hour off in winter?
America/New_York, and the library picks the offset for each date.Should I store the time zone with the timestamp?
Europe/Amsterdam. The zone tells you how to show the moment, but it doesn't change the moment. For a future local time, store the local date, the time and the zone name instead, as the verdict above explains.How do I convert a Unix timestamp to local time in JavaScript?
Date counts milliseconds, as MDN's Date.now() page describes, so multiply seconds by 1000 first. Then pass the zone to toLocaleString: new Date(timestamp * 1000).toLocaleString('en-US', { timeZone: 'Asia/Kolkata' }). The MDN Intl.DateTimeFormat reference says the default is the runtime's own zone, so always pass the reader's IANA name.Related tools
JSON Formatter
Validate, format, and minify JSON. Browse it as a tree, run JSONPath queries, compare two documents, or validate against a JSON Schema.
Use toolCron Generator
Visually build standard 5-part cron expressions or translate them into readable schedules.
Use toolText Encoding Converter
Convert text to Base64, binary, hex, URL encoding and HTML entities, and back again.
Use tool