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 and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page