Skip to content

Timezone

timezone_to_alpha2 takes a geographic timezone name such as Europe/Vienna and returns the corresponding alpha-2 country code e.g., AT if it's an exact match. If there's no exact match, the function returns None instead.

Usage Example

Basic Usage
1
2
3
4
5
6
import countrywrangler as cw

alpha2 = cw.Normalize.timezone_to_alpha2("Europe/Vienna")
print(alpha2)

>>> AT