Isoformat in Python 2.4

Sometimes I don't like python. Just sometimes, I love it most of the times. But just look what hoops I need to jump through to get a current timestamp in ISO format:

from datetime import datetime, tzinfo, timedelta

import time

class TZ(tzinfo): def utcoffset(self,dt): return timedelta(seconds=time.timezone) def dst(self,dt): return timedelta(0)

a =

a= a.replace(microsecond = 0)

print a.isoformat()

That prints:

asterisk:~ tim$ python




Comments powered by Disqus