How can I get a human-readable timezone name in Python?

前端 未结 7 1410
旧时难觅i
旧时难觅i 2020-12-10 12:06

In a Python project I\'m working on, I\'d like to be able to get a \"human-readable\" timezone name of the form America/New_York, corresponding to the syste

7条回答
  •  萌比男神i
    2020-12-10 12:54

    # use tzlocal library

    from tzlocal import get_localzone
    
    current_timezone = get_localzone()
    zone = current_timezone.zone
    print(zone)  
    

提交回复
热议问题