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 Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page