Ways to get number of seconds from Epoch

Mark McEahern marklists at mceahern.com
Wed May 1 17:00:25 EDT 2002


> Each record have recorded time as follows:
> 
> [15/Apr/2002:08:28:56 +0200]

That format seems a little odd:

o The slash separator with month name abbreviations.
o The colon between year and hour.

If I happily modify it slightly, it works beautifully with mx.DateTime:

>>> from mx.DateTime import DateTimeFrom
>>> s = "15 Apr 2002 08:28:56 +0200"
>>> dt = DateTimeFrom(s)
>>> dt.gmticks()
1018852136.0
>>> dt.ticks()
1018870136.0

Cheers,

// mark





More information about the Python-list mailing list