Broad Network


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

This is part 1 of my series, Date and Time in PHP. In this part of the series I talk about local time, Greenwich Mean Time (G.M.T) and Coordinated Universal Time (UTC). This part of the series deals more with geography than programming. In order to understand the use of the localtime() and gmdate() functions, you need to understand this basic geography. You should have read the previous series before coming here, as this is the continuation.

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.

Relationship between Greenwich Mean Time and Local Time
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[edit source | editbeta]

UTC-11:00, X[edit source | editbeta]

UTC-10:00, W[edit source | editbeta]

Principal cities: Papeete, Honolulu

UTC-09:30, V†[edit source | editbeta]

UTC-09:00, V[edit source | editbeta]

Principal cities: Anchorage

UTC-08:00, U[edit source | editbeta]

Principal cities: Los Angeles, Vancouver, Tijuana

UTC-07:00, T[edit source | editbeta]

Principal cities: Phoenix, Calgary, Ciudad Juárez

UTC-06:00, S[edit source | editbeta]

Principal cities: Chicago, Guatemala City, Mexico City, San José, San Salvador, Tegucigalpa, Winnipeg

UTC-05:00, R[edit source | editbeta]

Principal cities: New York, Lima, Toronto, Bogotá, Havana, Kingston

UTC-04:30, Q†[edit source | editbeta]

Principal cities: Caracas

UTC-04:00, Q[edit source | editbeta]

Principal cities: Santiago, La Paz, San Juan de Puerto Rico, Manaus, Halifax

UTC-03:30, P†[edit source | editbeta]

Principal cities: St. John's

UTC-03:00, P[edit source | editbeta]

Principal cities: Buenos Aires, Montevideo, São Paulo

UTC-02:00, O[edit source | editbeta]

UTC-01:00, N[edit source | editbeta]

UTC±00:00, Z[edit source | editbeta]

Principal cities: Accra, Abidjan, Casablanca, Dakar, Dublin, Lisbon, London

UTC+01:00, A[edit source | editbeta]

Principal cities: Amsterdam, Belgrade, Berlin, Brussels, Kinshasa, Lagos, Madrid, Paris, Rome, Stockholm, Tunis, Warsaw, Zurich

UTC+02:00, B[edit source | editbeta]

Principal cities: Athens, Sofia, Cairo, Kiev, Istanbul, Beirut, Helsinki, Jerusalem, Johannesburg, Bucharest

UTC+03:00, C[edit source | editbeta]

Principal cities: Nairobi, Baghdad, Doha, Khartoum, Minsk, Riyadh

UTC+03:30, C†[edit source | editbeta]

Principal cities: Tehran

UTC+04:00, D[edit source | editbeta]

Principal cities: Baku, Dubai, Moscow

UTC+04:30, D†[edit source | editbeta]

Principal cities: Kabul

UTC+05:00, E[edit source | editbeta]

Principal cities: Karachi, Tashkent

UTC+05:30, E†[edit source | editbeta]

Principal cities: Colombo, Delhi, Mumbai

UTC+05:45, E†[edit source | editbeta]

Principal cities: Kathmandu

UTC+06:00, F[edit source | editbeta]

Principal cities: Almaty, Dhaka, Yekaterinburg

UTC+06:30, F†[edit source | editbeta]

Principal cities: Yangon

UTC+07:00, G[edit source | editbeta]

Principal cities: Jakarta, Bangkok, Novosibirsk, Hanoi

UTC+08:00, H[edit source | editbeta]

Principal cities: Perth, Beijing, Manila, Singapore, Kuala Lumpur, Denpasar, Krasnoyarsk

UTC+08:45, H†[edit source | editbeta]

UTC+09:00, I[edit source | editbeta]

Principal cities: Seoul, Tokyo, Pyongyang, Ambon, Irkutsk

UTC+09:30, I†[edit source | editbeta]

Principal cities: Adelaide

UTC+10:00, K[edit source | editbeta]

Principal cities: Canberra, Yakutsk, Port Moresby

UTC+10:30, K†[edit source | editbeta]

UTC+11:00, L[edit source | editbeta]

Principal cities: Vladivostok, Noumea

UTC+11:30, L†[edit source | editbeta]

UTC+12:00, M[edit source | editbeta]

Principal cities: Auckland, Suva

UTC+12:45, M†[edit source | editbeta]

UTC+13:00, M†[edit source | editbeta]

UTC+14:00, M†[edit source | editbeta]


Related Links

Basics of PHP with Security Considerations
White 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

Cousins

NEXT

Comments