Skip to main content

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


Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page