The world is split hierachically into time zones.
The splitting may be done over two dimensions:
There are 24 longitudinal time zones (one time zone for one hour) that have an offset or acronym identifier
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:
If you care about the local time, you should store the UTC time and the city time zone.
An identifier can be:
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:
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):
where:
An abbreviation name or acronym represents a longitudinal time zone.
Time zone abbreviations like 'EST' are used by:
The acronyms end up generally with:
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:
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:
The timezone database 3) is also known as:
This CSV has the list of all time zones with their name, abbreviation, and DST settings.
epoch and the SQL timestamp does not store any time zone information.
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");