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:%
the isoformat
method accepts a parameter specifing the character(s) dividing the date part from the time part of a datetime obj in its representation. Therefore:
>>> utctime.isoformat(" ")
'1601-01-01 00:00:00.000050'
should do it. Furthermore, if you want to remove the microseconds you can operate a split.
>>> utctime.isoformat(" ").split(".")[0]
'1601-01-01 00:00:00'