从 UTC 偏移量获取时区缩写 [英] Get timezone abbreviation from UTC offset

查看:64
本文介绍了从 UTC 偏移量获取时区缩写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据库中有用户的 UTC 偏移量:

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

+5:30 

如何使用 Python 从这个 UTC 偏移量中获取时区缩写?

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

比如

+5:30 => IST

甚至可以使用 Python 来做到这一点吗?

Is it even possible to do this using Python?

推荐答案

这是不可能的.

时区缩写没有统一的标准.有一些列出的这里这里,可以看到两个方向都有重复.

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.

例如:

  • CST 可能是 -5:00、-6:00、+8:00、+9:30 或 +10:30.
  • -10:00 可以是 HST、HAST、TAHT 或 CKT

另请阅读 StackOverflow 上时区标签维基的时区!=偏移"部分.

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

这篇关于从 UTC 偏移量获取时区缩写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆