Date & Time
Imagine you wanna build an app which enables its users to schedule virtual meetings. And your user base is gonna be international. So how you’re gonna deal with topics such as different countries timezones, daylight saving time, etc.
Fortunately Python comes to rescue with its built-in datetime module :mechanical_arm:. But lets first learn about them a bit:
Timezones
-
The sun rises in the east. And if we travel to the east the sun will rise 1 hour earlier for every 15 degrees (of longitude) east you go from Greenwich and if you go west it will go down by 1 hour for every 15 degrees.

As you can see most of the lines ain’t straight. Timezones are decided based on political reasons and not geographical.
- Timezones help us to keep the daylight consistent across the planet.
-
Timezones & daylight saving times is “interesting”. For instance:
-
On 29.12.2011, Samoa switched sides of the international date line for the second time, losing December 30 in the process.
-
Samoa is a South Pacific nation that has jumped the international date line for business reasons.

- And the reason that they could do it was that they are really close to the international date line.
- BTW they also lost 30th of December as a direct consequence of this jump!
- Just google: “samoa timezone change story” to learn more.
-
-
Jargons
| Jargon | Definition | ||||
|---|---|---|---|---|---|
| The Unix epoch | The epoch is the reference point from which Unix time starts counting. Defined as midnight (00:00 UTC) on January 1, 1970 (why this date?). | ||||
| UTC | Coordinated Universal Time. The primary time standard globally used to regulate clocks and time (Why UTC and not CUT?). Times will be measured against UTC. | ||||
| GMT |
The IANA timezone database |
|
DST |
Acronym of Daylight Saving Time. Time goes one hour:
|
|