stuartbishop.net

PosixTimeZone

PosixTimeZone is a tzinfo implementation for Python 2.3, using the POSIX calls provided by many operating systems to handle timezone calculations.

Version 1.0 will be released after Python 2.3 and I have confirmed that the test suite runs.

This software may build and run under Windows. I'd be interested in hearing from anyone who tries this.

>>> 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'
>>>