Overview:
-
The ZoneInfo class represents an IANA timezone.
-
The ZoneInfo class is intended to work with a DateTime instance.
-
When a DateTime instance is created with a ZoneInfo object it supports the IANA timezone as well as the daylight saving time.
Example:
# Example Python program that converts # Create an instance of ZoneInfo # Specify date and time # Create a datetime instance with a given ZoneInfo # Create another instance of ZoneInfo # Convert from one time zone to another time zone zone |
Output:
Time in America/New_York: 2020-12-31 13:00:00-05:00 EST Time in America/Chicago: 2020-12-31 12:00:00-06:00 CST |