Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get timezone abbreviation from UTC offset

I have the UTC offset in my DB for the users:

+5:30 

How can I get the timezone abbreviation from this UTC offset using Python?

Such as

+5:30 => IST

Is it even possible to do this using Python?

like image 258
Viren Rajput Avatar asked Sep 17 '25 20:09

Viren Rajput


1 Answers

This is not possible.

  • There are many time zones that share the same offset. See this Wikipedia article for details.

  • There is no uniform standard for time zone abbreviations. There are some listed here and here, and you can see that there are duplicates in both directions.

    For example:

    • CST might be -5:00, -6:00, +8:00, +9:30 or +10:30.
    • -10:00 could be HST, HAST, TAHT, or CKT

Read also the section "Time Zone != Offset" of the timezone tag wiki here on StackOverflow.

like image 151
Matt Johnson-Pint Avatar answered Sep 20 '25 08:09

Matt Johnson-Pint