Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Timezone Examples | Timezones and Daylight Savings Time (DST)
Dealing with Dates and Times in Python
course content

Contenido del Curso

Dealing with Dates and Times in Python

Dealing with Dates and Times in Python

1. Working with Dates
2. Working with Times
3. Timezones and Daylight Savings Time (DST)
4. Working with Dates and Times in pandas

Timezone Examples

In the previous chapter, you saw one timezone: America/Edmonton. But the total number of even common timezones is quite big: more than 400! But you can see, that timezone by default contain continent name and city. So, we can explore the variety of timezones across the specific continent.

Since .all_timezones and common_timezones methods return lists, we can easily iterate over them. For example, using list comprehension, we can easily count the number of timezones containing 'America'.

123456
# Load library import pytz # Count number of american timezones using list comprehension american_timezones = len([x for x in pytz.common_timezones if 'America' in x]) print(f"There are {american_timezones} american timezones available in pytz.common_timesones.")
copy

Tarea

Iterate over .common_timezones and print only timezones containing Europe.

Tarea

Iterate over .common_timezones and print only timezones containing Europe.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 3. Capítulo 2
toggle bottom row

Timezone Examples

In the previous chapter, you saw one timezone: America/Edmonton. But the total number of even common timezones is quite big: more than 400! But you can see, that timezone by default contain continent name and city. So, we can explore the variety of timezones across the specific continent.

Since .all_timezones and common_timezones methods return lists, we can easily iterate over them. For example, using list comprehension, we can easily count the number of timezones containing 'America'.

123456
# Load library import pytz # Count number of american timezones using list comprehension american_timezones = len([x for x in pytz.common_timezones if 'America' in x]) print(f"There are {american_timezones} american timezones available in pytz.common_timesones.")
copy

Tarea

Iterate over .common_timezones and print only timezones containing Europe.

Tarea

Iterate over .common_timezones and print only timezones containing Europe.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 3. Capítulo 2
toggle bottom row

Timezone Examples

In the previous chapter, you saw one timezone: America/Edmonton. But the total number of even common timezones is quite big: more than 400! But you can see, that timezone by default contain continent name and city. So, we can explore the variety of timezones across the specific continent.

Since .all_timezones and common_timezones methods return lists, we can easily iterate over them. For example, using list comprehension, we can easily count the number of timezones containing 'America'.

123456
# Load library import pytz # Count number of american timezones using list comprehension american_timezones = len([x for x in pytz.common_timezones if 'America' in x]) print(f"There are {american_timezones} american timezones available in pytz.common_timesones.")
copy

Tarea

Iterate over .common_timezones and print only timezones containing Europe.

Tarea

Iterate over .common_timezones and print only timezones containing Europe.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

In the previous chapter, you saw one timezone: America/Edmonton. But the total number of even common timezones is quite big: more than 400! But you can see, that timezone by default contain continent name and city. So, we can explore the variety of timezones across the specific continent.

Since .all_timezones and common_timezones methods return lists, we can easily iterate over them. For example, using list comprehension, we can easily count the number of timezones containing 'America'.

123456
# Load library import pytz # Count number of american timezones using list comprehension american_timezones = len([x for x in pytz.common_timezones if 'America' in x]) print(f"There are {american_timezones} american timezones available in pytz.common_timesones.")
copy

Tarea

Iterate over .common_timezones and print only timezones containing Europe.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 3. Capítulo 2
Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
We're sorry to hear that something went wrong. What happened?
some-alt