convert time to UTC seconds since epoch
Ian Kelly
ian.g.kelly at gmail.com
Tue Jul 20 21:01:48 EDT 2010
On Tue, Jul 20, 2010 at 4:51 PM, Alexander <b3nder at yandex.ru> wrote:
> On 21.07.2010 00:46, Rami Chowdhury wrote:
>> On Jul 20, 2010, at 12:26 , Alexander wrote:
>>
>>> Hi, list
>>>
>>> How with python standard library to convert string like 'YYYY-MM-DD
>>> mm:HH:SS ZONE' to seconds since epoch in UTC? ZONE may be literal time
>>> zone or given in explicit way like +0100.
>> If you have a sufficiently recent version of Python, have you considered time.strptime: http://docs.python.org/library/time.html#time.strptime ?
>>
> Yes. May be I don't undertand something. but it seems strptime doesn't
> work with timezones at all. Only understands localzone and dates w/o zones.
Have you looked at the dateutil.parser module? It's not part of the
standard library but probably does what you need.
http://labix.org/python-dateutil#head-c0e81a473b647dfa787dc11e8c69557ec2c3ecd2
Cheers,
Ian
More information about the Python-list
mailing list