Parsing timestamp with Python2.4

Posted by jellybean on Stack Overflow See other posts from Stack Overflow or by jellybean
Published on 2010-06-08T13:40:52Z Indexed on 2010/06/08 13:52 UTC
Read the original article Hit count: 179

Filed under:
|
|
|

I want to parse a timestamp from a log file that has been written via

datetime.datetime.now().strftime('%Y%m%d%H%M%S')

and then compute the number of seconds that have passed since this timestamp.

I know I could do it with datetime.datetime.strptime to get back a datetime object and then compute a timedelta. Problem is, the strptime function has been introduced with Python 2.5 and I'm using Python2.4.4 (an upgrade is not possible in my context).

Any easy way to do this?

© Stack Overflow or respective owner

Related posts about python

Related posts about datetime