Geographical Time and PHP
Date and Time in PHP with Security Considerations - Part 1
Foreword: In this part of the series I talk about local time, Greenwich Mean Time (G.M.T) and Coordinated Universal Time (UTC).
By: Chrysanthus Date Published: 19 Jan 2019
Introduction
Longitude
The world is round. It has a North Pole and a South Pole. There are imaginary circles traced from the North Pole to the South Pole and back to the North Pole. Seen along the equator, the distances between these circle lines are equally spaced. 360 of these circles are in place. These circles are imaginary; they do not really exist. However they are useful in giving us the time. They are called longitudes.
These longitudes are numbered and the numbers have the unit of degree. The longitude that passes through Britain in Europe and Ghana in Africa is longitude 0 degree. The next longitude to the east is longitude 1 degree. The next one still to the east is longitude 2 degrees; and so on.
These longitudes are grouped in equal groups of 15 longitudes per group. I call each of these groups a clock zone. There are 24 of these clock zones (seen along round the equator). Here 24 correspond to 24 hours a day. Longitude 0 degree is in the middle of its own clock zone.
Time
In simple terms, consecutive clock zones have one-hour difference. Let us say it is 12 mid-night now in the clock zone of longitude 0 degree (Britain or Ghana). The time at the next clock zone east (Germany in Europe, Cameroon in Africa) should be 1 O’clock in the morning; the time in the clock zone eastward again (Finland in Europe, Zimbabwe in Africa) should be 2 O’clock in the morning. You can trace round like this, along the equator, to be back at the stating point, forming a 24-hour clock. In practice the time in some countries do not follow this clock zone model strictly. You may have to consult some other documents for the details.
Local Time
When the sun is directly above your head, that is 12 noon in your country. That is your local time (it is not Greenwich Mean Time). Imagine that you are in Finland, which is 2 clock zones east of Britain. Britain has the reference clock zone. If the time in Finland is 2 O’clock, Finland’s local time, at that same time it would be 1 O’clock in Germany, German’s local time, and 0 O’clock in Britain, Britain’s local time.
Greenwich Mean Time
If you are in the clock zone of longitude 0 degree (Britain), the time you read from your watch is said to be Greenwich Mean Time. So, at the time 0 mid-night in Britain, we say the time is 0 O’clock Greenwich Mean Time. At that same time it is still 0 O’clock Greenwich Mean Time in Germany, and still 0 O’clock Greenwich Mean Time in Finland. The clock zone with longitude 0 degree passing through Britain is the reference clock zone for Greenwich Mean Time. Greenwich Mean time is the same in every country. For example, 1 O’clock Greenwich Mean Time is 1 O’clock Greenwich Mean Time in every country, which is 1 O’clock local time in Britain (since the British clock zone is the reference).
Note: 0 O’clock is also said to be 24 0’clock in the 24 hour-clock.
To get the approximate local time of a country in the east (of Britain) from the Greenwich Mean Time, add the number of corresponding clock zones to the east of Britain. To get the approximate local time of a country in the west (of Britain) from the Greenwich Mean Time, subtract the number of corresponding clock zones to the west of Britain. For example, if the Greenwich Mean Time is 3 O’clock, Finland would have 3 + 2 = 5 O’clock, local time. Greenwich Mean Time is the local time of Britain and Ghana and any other country in the clock zone of longitude 0 degree. There is more to time zones than I have indicated here; you may have to consult other documents for the details.
The Hour
There are 24 hours in a day. The hour is divided into 60 minutes, which are each divided into 60 seconds.
Daylight Saving Time
In European countries the sun may not rise and set when you want in some seasons. So the country may change the expected time by one hour, for convenience, in a season. This is daylight saving, giving the phrase, “Daylight Saving Time”. When a country does this in a season, we say Daylight Saving Time is in effect.
Coordinated Universal Time
Coordinated Universal Time abbreviated, UTC is similar to the above explanation, but there are some important differences. In UTC, clock zones are different and are called time zone offsets. A time zone offset is not demarcated regularly from top to bottom. In some places in the globe, you may have one time zone offset vertically above another, having a different local time. The reference for GMT and UTC is Britain. The diagram at the bottom of this page, copied from Wikipedia, shows the standard time zones of the world (you may have to scroll down to see the diagram):
The time zone offsets have technical names. These names are given below with the different countries and regions belonging to each zone. Again the list is copied from Wikipedia.
Today we have GMT and UTC. However, UTC is more preferred, today.
Well, you have seen enough of geography. In the next part of the series, we shall dive into the PHP programming features for Date and Time.
Chrys
Standard Time Zones of the World
List of Standard Time Zones of the World
UTC-12:00, Y
UTC-11:00, X
- United States
- American Samoa
- Hawaii
- French Frigate Shoals and all of the Northwestern Hawaiian Islands located further west[3][4]
- United States Minor Outlying Islands
- New Zealand
UTC-10:00, W
Principal cities: Papeete, Honolulu
- France
- French Polynesia (except Marquesas Islands and Gambier Islands)
- New Zealand
- United States
- Alaska
- Aleutian Islands west of 169.30°W[6][7]
- Hawaii
- As far west as Necker Island[8][9]
- United States Minor Outlying Islands
- Alaska
UTC-09:30, V†
UTC-09:00, V
Principal cities: Anchorage
- France
- United States –Alaska Time Zone
- Alaska
- Except Aleutian Islands west of 169.30°W[7]
- Alaska
UTC-08:00, U
Principal cities: Los Angeles, Vancouver, Tijuana
- Canada[12]
- France
- Mexico
- United Kingdom
- United States (Pacific Time Zone)[14]
- California
- Idaho
- North of Salmon River[15]
- Nevada (except West Wendover)
- Oregon
- All of the state except Malheur County (but including a small strip in the south of Malheur)
- Washington
UTC-07:00, T
Principal cities: Phoenix, Calgary, Ciudad Juárez
- Canada[16]
- Mexico
- United States (Mountain Time Zone)[14]
- Arizona
- Colorado
- Idaho[15]
- South of Salmon River
- Kansas
- Montana
- Nebraska
- Nevada
- New Mexico
- North Dakota
- Oregon
- Malheur County (except a small strip in the south)
- South Dakota
- Texas
- Utah
- Wyoming
UTC-06:00, S
Principal cities: Chicago, Guatemala City, Mexico City, San José, San Salvador, Tegucigalpa, Winnipeg
- Belize
- Canada (CT – North American Central Time Zone)
- Manitoba
- Nunavut
- Kivalliq Region except Southampton Island (Coral Harbour) which is on Eastern Time and does not observe DST
- Ontario
- Northwestern Ontario (West of 90° West, except Atikokan area, New Osnaburgh and Pickle Lake area, Shebandowan and Upsala area, and Big Trout Lake area east of 90° West)
- Saskatchewan
- All province except Lloydminster and surrounding area (Creighton and Denare Beach area does observe DST unofficially)
- Chile
- Costa Rica
- Ecuador
- El Salvador
- Guatemala[18]
- Honduras
- Mexico
- All of the country except the states of Baja California, Baja California Sur, Chihuahua, Nayarit, Sinaloa and Sonora.[13]
- Nicaragua
- United States (CT – Central Time Zone)
- Alabama
- Entire state except Phenix City
- Arkansas
- Florida
- West of the Apalachicola River, except for the portions of Franklin County and Gulf County south of the Intracoastal Waterway
- Illinois
- Indiana[19]
- Iowa
- Kansas
- Entire state except westernmost counties
- Kentucky
- Louisiana
- Michigan[21]
- Minnesota
- Mississippi
- Missouri
- Nebraska
- Central and eastern Nebraska
- North Dakota
- Entire state except southwest
- Oklahoma
- Entire state except Kenton
- South Dakota
- Eastern half
- Tennessee
- Texas
- Entire state except westernmost counties
- Wisconsin
- Alabama
UTC-05:00, R
Principal cities: New York, Lima, Toronto, Bogotá, Havana, Kingston
- Bahamas
- Canada
- Nunavut
- Qikiqtaaluk Region except Resolute which is on Central Time
- Ontario
- East of 90° West except Big Trout Lake area
- Atikokan area
- New Osnaburgh and Pickle Lake area
- Upsala (West of 90° West)
- Quebec
- Most of province except easternmost area
- Nunavut
- Colombia[23]
- Cuba
- Ecuador[23]
- Haiti
- Jamaica
- Panama[23]
- Peru[23]
- United Kingdom
- United States (Eastern Time)[14]
- Delaware
- District of Columbia
- Florida
- Georgia
- Indiana[19]
- Kentucky
- Maryland
- Michigan[21]
- New England (states of Connecticut, Massachusetts, Maine, New Hampshire, Rhode Island and Vermont)[14]
- New Jersey
- New York
- North Carolina
- Ohio
- Pennsylvania
- South Carolina
- Tennessee
- Virginia
- West Virginia
- United States Minor Outlying Islands
UTC-04:30, Q†
Principal cities: Caracas
UTC-04:00, Q
Principal cities: Santiago, La Paz, San Juan de Puerto Rico, Manaus, Halifax
- Antigua and Barbuda[27]
- Barbados[27]
- Bolivia[27]
- Brazil[28]
- The states of Acre, Amazonas, Mato Grosso, Mato Grosso do Sul, Rondônia and Roraima
- Canada - Atlantic Time Zone
- New Brunswick
- Newfoundland and Labrador
- Labrador
- Except the area between L'Anse-au-Clair and Norman Bay[29]
- Labrador
- Nova Scotia
- Prince Edward Island
- Quebec
- East of the 63°W longitude
- Chile
- Denmark
- Greenland[30]
- North-western area including Qaanaaq (Thule) and Pituffik
- Greenland[30]
- Dominica[27]
- Dominican Republic[27]
- France
- Grenada[27]
- Guyana[27]
- Netherlands
- Paraguay
- Saint Kitts and Nevis[31]
- Saint Lucia[27]
- Saint Vincent and the Grenadines[31]
- Trinidad and Tobago[27]
- United Kingdom
- United States
UTC-03:30, P†
Principal cities: St. John's
- Canada - Newfoundland Time Zone[29]
- Newfoundland and Labrador
- Labrador
- The area between L'Anse-au-Clair and Norman Bay
- Newfoundland
- Labrador
- Newfoundland and Labrador
UTC-03:00, P
Principal cities: Buenos Aires, Montevideo, São Paulo
- Argentina[23]
- Brazil[28]
- Except the western states of Acre, Amazonas, Mato Grosso, Mato Grosso do Sul, Rondônia and Roraima; and offshore islands
- Denmark
- Greenland[30]
- Except areas around Qaanaaq, Danmarkshavn and Ittoqqortoormiit
- Greenland[30]
- France
- Suriname[23]
- United Kingdom
- Uruguay[23]
UTC-02:00, O
UTC-01:00, N
- Cape Verde
- Denmark
- Greenland[30]
- Ittoqqortoormiit and surrounding area
- Greenland[30]
- Portugal:
- Azores islands
UTC±00:00, Z
Principal cities: Accra, Abidjan, Casablanca, Dakar, Dublin, Lisbon, London
- Burkina Faso[34]
- Côte d'Ivoire[34]
- Denmark
- Faroe Islands
- Greenland[30]
- Danmarkshavn and surrounding area
- Gambia[34]
- Ghana[34]
- Guinea[34]
- Guinea-Bissau[34]
- Iceland[35]
- Ireland[35]
- Liberia[34]
- Mali[34]
- Mauritania[34]
- Morocco[34]
- Portugal[35] (Including Madeira and excluding Azores islands)
- Sahrawi Republic[34] (limited recognition)
- São Tomé and Príncipe
- Spain
- Senegal[34]
- Sierra Leone[34]
- Togo[34]
- United Kingdom[35] (Including Guernsey, Isle of Man, Jersey and Saint Helena, Ascension and Tristan da Cunha)
UTC+01:00, A
Principal cities: Amsterdam, Belgrade, Berlin, Brussels, Kinshasa, Lagos, Madrid, Paris, Rome, Stockholm, Tunis, Warsaw, Zurich
- Albania[36]
- Algeria
- Andorra[36]
- Angola
- Austria[36]
- Belgium[36]
- Benin
- Bosnia and Herzegovina[36]
- Cameroon
- Central African Republic
- Chad
- Congo-Brazzaville
- Democratic Republic of the Congo
- Croatia[36]
- Czech Republic[36]
- Denmark[36]
- Equatorial Guinea
- France[36]
- Gabon
- Germany[36]
- Hungary[36]
- Italy[36]
- Kosovo[36]
- Libya[38]
- Liechtenstein[36]
- Luxembourg[36]
- Macedonia[36]
- Malta[36]
- Monaco[36]
- Montenegro[36]
- Namibia
- Netherlands[36]
- Niger
- Nigeria
- Norway[36] (Including Svalbard and Jan Mayen)
- Poland[36]
- San Marino[36]
- Serbia[36]
- Slovakia[36]
- Slovenia[36]
- Spain[36] (Including Balearic Islands,[36] Ceuta and Melilla and excluding Canary Islands)
- Sweden[36]
- Switzerland[36]
- Tunisia
- United Kingdom
- Vatican City
UTC+02:00, B
Principal cities: Athens, Sofia, Cairo, Kiev, Istanbul, Beirut, Helsinki, Jerusalem, Johannesburg, Bucharest
- Botswana[34]
- Bulgaria[36]
- Burundi[34]
- Cyprus (Including Northern Cyprus)[36]
- Democratic Republic of the Congo[37]
- The provinces of Kasaï Occidental, Kasaï Oriental, Katanga, Maniema, Nord-Kivu, Orientale and Sud-Kivu
- Egypt
- Estonia[36]
- Finland[36]
- Greece[36]
- Israel
- Latvia[36]
- Lebanon
- Lesotho[34]
- Lithuania[36]
- Malawi[34]
- Moldova[36]
- Mozambique[34]
- Palestine
- Romania[36]
- Rwanda[34]
- South Africa[34]
- Swaziland[34]
- Syria
- Turkey[36]
- Ukraine[36]
- United Kingdom
- Zambia[34]
- Zimbabwe[34]
UTC+03:00, C
Principal cities: Nairobi, Baghdad, Doha, Khartoum, Minsk, Riyadh
- Bahrain[39]
- Belarus[40]
- Comoros
- Djibouti
- Eritrea
- Ethiopia
- France
- Iraq[39]
- Jordan[44]
- Kenya
- Kuwait[39]
- Madagascar[45]
- Qatar[39]
- Russia
- Saudi Arabia[39]
- Somalia
- South Africa[45]
- Southern Sudan
- Sudan
- Tanzania
- Uganda
- Yemen[39]
UTC+03:30, C†
Principal cities: Tehran
UTC+04:00, D
Principal cities: Baku, Dubai, Moscow
- Armenia
- Azerbaijan
- France
- Georgia[50][51]
- Mauritius
- Oman
- Russia - Moscow Time[52]
- Seychelles
- United Arab Emirates
UTC+04:30, D†
Principal cities: Kabul
UTC+05:00, E
Principal cities: Karachi, Tashkent
- Australia[45]
- France
- Kazakhstan[53]
- The provinces of Aktobe, Atyrau, Mangystau and West Kazakhstan
- Maldives
- Pakistan[39]
- Tajikistan[39]
- Turkmenistan[39]
- Uzbekistan[39]
UTC+05:30, E†
Principal cities: Colombo, Delhi, Mumbai
UTC+05:45, E†
Principal cities: Kathmandu
UTC+06:00, F
Principal cities: Almaty, Dhaka, Yekaterinburg
- Bangladesh[54]
- Bhutan[54]
- Kazakhstan[53]
- Except the provinces of Aktobe, Atyrau, Mangystau and West Kazakhstan
- Kyrgyzstan[57]
- Russia - Yekaterinburg Time[52]
- United Kingdom
UTC+06:30, F†
Principal cities: Yangon
UTC+07:00, G
Principal cities: Jakarta, Bangkok, Novosibirsk, Hanoi
- Australia
- Cambodia[54]
- Indonesia[59][60]
- Laos[54]
- Mongolia[61]
- Western part, including Hovd
- Russia - Omsk Time[52]
- Thailand[54]
- Vietnam[54]
UTC+08:00, H
Principal cities: Perth, Beijing, Manila, Singapore, Kuala Lumpur, Denpasar, Krasnoyarsk
- Australia[62]
- Western Australia (except Eucla)
- Brunei[54]
- China[54]
- Indonesia[59][63]
- Malaysia[64]
- Mongolia[65]
- Eastern part, including Ulaanbaatar
- Philippines[54]
- Russia - Krasnoyarsk Time[52]
- Singapore[64]
- Taiwan[54]
UTC+08:45, H†
UTC+09:00, I
Principal cities: Seoul, Tokyo, Pyongyang, Ambon, Irkutsk
- Indonesia[59][63]
- Japan (JST – Japan Standard Time)
- North Korea
- South Korea (KST – Korea Standard Time)
- Palau
- Russia - Irkutsk Time[52]
- Timor-Leste
UTC+09:30, I†
Principal cities: Adelaide
UTC+10:00, K
Principal cities: Canberra, Yakutsk, Port Moresby
- Australia[62]
- Federated States of Micronesia
- Papua New Guinea
- Russia[66]
- Far Eastern Federal District
- Amur Oblast, Zabaykalsky Krai and Sakha Republic (western part)
- Far Eastern Federal District
- United States
UTC+10:30, K†
UTC+11:00, L
Principal cities: Vladivostok, Noumea
UTC+11:30, L†
UTC+12:00, M
Principal cities: Auckland, Suva
- Antarctica
- Ross Dependency, McMurdo Station, Amundsen-Scott South Pole Station (Unofficial)
- France
- Fiji[69]
- Kiribati
- Marshall Islands[69]
- Nauru[69]
- New Zealand (except Chatham Islands)[71]
- Russia - Magadan Time[66]
- Tuvalu[69]
- United States
UTC+12:45, M†
UTC+13:00, M†
UTC+14:00, M†
Related Links
Basics of PHP with Security ConsiderationsWhite Space in PHP
PHP Data Types with Security Considerations
PHP Variables with Security Considerations
PHP Operators with Security Considerations
PHP Control Structures with Security Considerations
PHP String with Security Considerations
PHP Arrays with Security Considerations
PHP Functions with Security Considerations
PHP Return Statement
Exception Handling in PHP
Variable Scope in PHP
Constant in PHP
PHP Classes and Objects
Reference in PHP
PHP Regular Expressions with Security Considerations
Date and Time in PHP with Security Considerations
Files and Directories with Security Considerations in PHP
Writing a PHP Command Line Tool
PHP Core Number Basics and Testing
Validating Input in PHP
PHP Eval Function and Security Risks
PHP Multi-Dimensional Array with Security Consideration
Mathematics Functions for Everybody in PHP
PHP Cheat Sheet and Prevention Explained
More Related Links