The Golden Rule of Time in Software: Store UTC, Display Local
Every distributed system, REST API, and relational database faces the challenge of managing timezones. The industry-standard architecture follows a strict rule:
1. Capture in UTC
Clients or servers immediately normalize event times into UTC or raw Unix epoch integers.
2. Store as Integer / UTC
Databases store standard 64-bit integers or TIMESTAMP WITH TIME ZONE in UTC.
3. Render in User Zone
The frontend presentation layer formats the UTC date into the end user's local browser timezone.
Timezone Conversion Code Snippets (JavaScript, Python, Go)
JavaScript / TypeScriptIntl.DateTimeFormat
const timestamp = 1730123456 * 1000;
const date = new Date(timestamp);
// Format in Tokyo Time
const tokyoFormatter = new Intl.DateTimeFormat('en-US', {
timeZone: 'Asia/Tokyo',
dateStyle: 'full',
timeStyle: 'long',
});
console.log(tokyoFormatter.format(date));
// Format in New York Time
const nyFormatter = new Intl.DateTimeFormat('en-US', {
timeZone: 'America/New_York',
timeStyle: 'medium',
});
console.log(nyFormatter.format(date));Python 3.9+zoneinfo standard library
from datetime import datetime, timezone
from zoneinfo import ZoneInfo
# Create UTC datetime from timestamp
timestamp = 1730123456
dt_utc = datetime.fromtimestamp(timestamp, tz=timezone.utc)
# Convert to London time
dt_london = dt_utc.astimezone(ZoneInfo("Europe/London"))
print("London Time:", dt_london.strftime("%Y-%m-%d %H:%M:%S %Z"))
# Convert to India time
dt_ist = dt_utc.astimezone(ZoneInfo("Asia/Kolkata"))
print("IST Time:", dt_ist.strftime("%Y-%m-%d %H:%M:%S %Z"))Major World Timezones Reference Table
| Timezone Code | IANA Identifier | Standard Offset | Major Cities |
|---|---|---|---|
| UTC | Etc/UTC | UTC+00:00 | Universal Standard |
| EST / EDT | America/New_York | UTC-05:00 / UTC-04:00 | New York, Toronto, Miami |
| PST / PDT | America/Los_Angeles | UTC-08:00 / UTC-07:00 | San Francisco, Los Angeles, Seattle |
| GMT / BST | Europe/London | UTC+00:00 / UTC+01:00 | London, Dublin, Lisbon |
| CET / CEST | Europe/Paris | UTC+01:00 / UTC+02:00 | Paris, Berlin, Amsterdam |
| IST | Asia/Kolkata | UTC+05:30 (No DST) | Mumbai, New Delhi, Bengaluru |
| JST | Asia/Tokyo | UTC+09:00 (No DST) | Tokyo, Osaka, Kyoto |
