Timezone Database

Timezone Database:

Below code explanation:

- In the below code, we import datetime class from the datetime module and the tz variable from the dateutil module.

- The timezone database basically gets the timezone UTC from the specific country by their continent and city.

- We need to take the gettz() variable to get the timezone UTC and call it to the tz module to work with it.

- We need to take the Continent and City in strings
  Example- (“Asia/Kolkata”) India timezone.

- After that, we create a datetime object at a specific datetime with “tzinfo=” that accepts the timezone UTC of the tz named variable.

- After print, we get the datetime with India timezone UTC.


Comments