Python Time Zone Full Names

pytz contains a list of time zones in formats such as America / Chicago, America / Los Angeles, Asia / Calcutta or the abbreviation tz.

I need the full name for time zones.

  • Central Standard Time
  • Pacific Standard Time
  • Indian Standard Time

Is this possible in Python?

+4
source share
2 answers

The Unicode CLDR project contains many localized strings, including human-readable time zone names in different languages.

Python CLDR Babel. , , :

>>> british = get_timezone('Europe/London')
>>> format_datetime(dt, 'H:mm zzzz', tzinfo=british, locale='en_US')
u'16:30 British Summer Time'

, , dt, IANA ( pytz) Europe/London, - " ".

, , :

>>> from babel import Locale
>>> from babel.dates import get_timezone_name, get_timezone

>>> tz = get_timezone('Europe/Berlin')
>>> get_timezone_name(tz, locale=Locale.parse('pt_PT'))
u'Hor\xe1rio Alemanha'

, Europe/Berlin "Horário Alemanha".

+3
0

All Articles