I used :
utctime = datetime.datetime(1601,1,1) + datetime.timedelta(microseconds = tup[5])
last_visit_time = \"Last visit time:\"+ utctime.strftime(\'%Y-%m-%d %H:%M:%
I recommend using arrow (which is an abstraction package on datetime and dateutil), it's really easy to handle every kind of datetime objects, even in Python 2.6/7.x and with dates prior to 1900.
For example:
>>> import arrow
>>> in_date_str = "1853-10-30T13:36:41.942623+00:00"
>>> in_date_obj = arrow.get(crea)
>>> print(in_date_obj)
arrow[1853-10-30T13:36:41.942623+00:00]>
# basic formatting
>>> in_date_obj.format()
u'1853-10-30 13:36:41-00:00'
# advanced formatting
>>> in_date_obj.format("ffffdd D MMMM YYYY", "fr_FR")
u'Dimanche 30 Octobre 1853'
# humanized delta
>>> in_date_obj.humanize()
u'162 years ago'
# easy localization handling
>>> in_date_obj.humanize(locale="fr_FR")
u'il y a 162 ans'