ISO with timezone
nik
nikbaer at gmail.com
Mon Jan 28 21:03:09 EST 2008
Hi,
How does one express the time in ISO format with the timezone
designator?
what I want is YYYY-MM-DDThh:mm:ss.sTZD
>From the documentation I see:
>>> from datetime import tzinfo, timedelta, datetime
>>> class TZ(tzinfo):
... def utcoffset(self, dt): return timedelta(minutes=-399)
...
>>> datetime(2002, 12, 25, tzinfo=TZ()).isoformat(' ')
'2002-12-25 00:00:00-06:39'
and I've also figured out:
>>>datetime.datetime.fromtimestamp(time.time()).isoformat()[:-3]
'2008-01-23T11:22:54.130'
But can't figure out how to fit them together.
Thank you,
Nik
More information about the Python-list
mailing list