Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

datetime tzinfo class to hook into the OS timezone libraries

Project description

PosixTimeZone is a tzinfo implementation for Python 2.3, using the

POSIX calls provided by many operating systems to handle timezone calculations:

>>> from datetime import timedelta,datetime
>>> from PosixTimeZone import PosixTimeZone
>>> UTC = PosixTimeZone('UTC')
>>> Amsterdam = PosixTimeZone('Europe/Amsterdam')
>>> now = datetime.now(UTC)
>>> str(now)
'2003-01-30 07:01:07.885573+00:00'
>>> now.tzname()
'UTC'
>>> str(now.astimezone(Amsterdam))
'2003-01-30 08:01:07.885573+01:00'
>>> now.astimezone(Amsterdam).tzname()
'CET'

Project details


Release history Release notifications

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page