Use the datetime module.
td = datetime.strptime('2012-09-28T16:41:12.997656', '%Y-%m-%dT%H:%M:%S.%f') -
datetime.strptime('2012-09-28T23:57:44.663659', '%Y-%m-%dT%H:%M:%S.%f')
print td
# => datetime.timedelta(-1, 60208, 333997)
There is only one small problem: Your microseconds are one digit to long for %f
to handle. So I've removed the last digits from your input strings.