datetime-format

How to get current isoformat datetime string including the default timezone?

How to get current isoformat datetime string including the default timezone? Question: I need to produce a time string that matches the iso format yyyy-mm-ddThh:mm:ss.ssssss-ZO:NE. The now() and utcnow() class methods almost do what I want. >>> import datetime >>> #time adjusted for current timezone >>> datetime.datetime.now().isoformat() ‘2010-08-03T03:00:00.000000’ >>> #unadjusted UTC time >>> datetime.datetime.utcnow().isoformat() ‘2010-08-03T10:00:00.000000’ …

Total answers: 6