About
The world is split hierachically into time zones.
Type
The splitting may be done over two dimensions:
- longitudinal
- or city (Island)
Longitudinal
There are 24 longitudinal time zones (one time zone for one hour) that have an offset or acronym identifier
- In GMT / UTC, the longitudinal time zones are expressed using positive or negative offsets from the origin known as UTC or Z where 1 unity is one hour. They do not make any seasonal/political adjustments (i.e. does not observe Daylight Savings Time).
- Timezone acronyms will take into account the Daylight Savings Time. For instance:
- PST (Pacific Standard Time) for UTC−08:00 without Daylight Savings Time
- PDT (Pacific Daylight Time) for UTC−07:00 with Daylight Savings Time
City or Island
The world is split into city or Island time zones that have an id_identifier that take into account political divisions in order to apply seasonal adjustments known as Daylight Savings Time).
Note that the time zones are not split into countries because they would be too dependent in time on political and boundary changes.
The city time zone Europe/London is:
- in standard time: UTC+0
- in daylight time known as British Summer Time (BST): UTC+1
If you care about the local time, you should store the UTC time and the city time zone.
Identifiers
An identifier can be:
- a city or Island with:
- a full_name such as America/Los_Angeles,
- a longitudinal timezone with:
- an acronym / abbreviation such as PST,
- or a offset such as GMT-8:00.
Full name
The Time Zone full name is an Id.
A full name timezone ID is the identifier for a City or Island timezone name.
They are more than an offset as they may be influenced by political decisions, not just earth geometry.
They define:
- rules/history for Daylight Savings adjustments (DST)
- and other anomalies
It's therefore the only way to define the beginning and the end of a day.
This CSV has the list of all time zones with their name, abbreviation, and DST settings.
They are names 1):
- in the form Area/Location, e.g. Europe/London
- in English
where:
- Area is the name of a big region such as a continent, an ocean
- Location is the name of a specific location within the area (usually a city or small island)
- Area and Location names have a maximum length of 14 characters
Longitudinal time zone
Acronym
An abbreviation name or acronym represents a longitudinal time zone.
Time zone abbreviations like 'EST' are used by:
- traditionally by human
- and POSIX
The acronyms end up generally with:
- ST that means Standard Time
- and DT that means Daylight Time when Daylight saving time rules is applied
Note that this is not always true. For instance, BST means British Summer Time and is a Daylight saving time.
For instance:
There is therefore no one-to-one relationship with the timezone id. Example: the America/Los_Angeles timezone id is:
- in the PST timezone
- and PDT timezone
offset
A time zone identified by an offset is a longitudinal time zone (and not a political/civil time zone that may apply day light saving)
It's generally the gmt / UTC offset
Given a time zone ID, you can determine a UTC offset but the opposite is not true. There is not a 1:1 mapping from UTC offset back to a time zone id.
For example, the time zone for Sydney Australia/Sydney (New South Wales) is:
- UTC+10 EST (Eastern standard time),
- or UTC+11 EDT (Eastern Daylight time) during daylight savings time.
Database
The timezone database 3) is also known as:
- tz database,
- tzdata,
- zoneinfo database
- IANA time zone database,
- Olson database (in reference to the founder, Arthur David Olson)
This CSV has the list of all time zones with their name, abbreviation, and DST settings.
No timezone: Epoch / SQL Timestamp
epoch and the SQL timestamp does not store any time zone information.
Computer Language
timeZoneDesc = Intl.DateTimeFormat().resolvedOptions().timeZone;
console.log("Your time zone is: "+timeZoneDesc);
offsetMinutes = (new Date()).getTimezoneOffset();
let now = new Date();
console.log("UTC time (London) is: "+now.toISOString());
var timeZone = new Date(now.getTime()-1000*60*offsetMinutes);
console.log("Your local time ("+timeZoneDesc+") is: "+now.toLocaleString(window.navigator.language));
if (offsetMinutes <0) {
op = "subtract";
} else {
op = "add";
}
console.log("To go to UTC, you need to "+op+" "+Math.abs(offsetMinutes)+" minutes (ie "+offsetMinutes/60+" hour) from your local time. If you are in a time zone that has Daylight Savings Time, your zone may be off of 1 from UTC");