I\'m having trouble formatting a datetime.timedelta
object.
Here\'s what I\'m trying to do: I have a list of objects and one of the members of the cl
My datetime.timedelta
objects went greater than a day. So here is a further problem. All the discussion above assumes less than a day. A timedelta
is actually a tuple of days, seconds and microseconds. The above discussion should use td.seconds
as joe did, but if you have days it is NOT included in the seconds value.
I am getting a span of time between 2 datetimes and printing days and hours.
span = currentdt - previousdt
print '%d,%d\n' % (span.days,span.seconds/3600)