Paul McGuire wrote:
> "Carl J. Van Arsdall" wrote:
>> Basically I used the datetime module and timedelta objects to calculate a
>> difference between two times. Now I'm trying to figure out how I make
>> that time delta a string HH:MM:SS to show elapsed time.
[...]
> From the Python console:
>
>>> startTime = datetime.timedelta(seconds=45,minutes=22,hours=10)
>>> stopTime = datetime.timedelta(seconds=25,minutes=2,hours=4)
>>> delta = startTime-stopTime
>>> time.strftime("%H:%M:%S",time.gmtime(delta.seconds))
'06:20:20'
Which, alas, will lose any subsecond resolution
> Well, kinda, although I can work with this, str(tdobject) returns a
> string that looks like:
>
> -1 day, 7:34:32
Oh yeah. I had tried it on a positive timedelta, which does give HH:MM:SS
--
Posted via a free Usenet account from http://www.teranews.com
--
http://mail.python.org/mailman/l
"Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Basically I used the datetime module and timedelta objects to calculate a
> difference between two times. Now I'm trying to figure out how I make
> that time delta a string HH:MM:SS to show elapsed time. I've s
tobiah wrote:
> Carl J. Van Arsdall wrote:
>
>> Basically I used the datetime module and timedelta objects to calculate
>> a difference between two times. Now I'm trying to figure out how I make
>> that time delta a string HH:MM:SS
>>
>>
>>
>
> Oddly enough, str(tdobject) does what you
Carl J. Van Arsdall wrote:
> Basically I used the datetime module and timedelta objects to calculate
> a difference between two times. Now I'm trying to figure out how I make
> that time delta a string HH:MM:SS
>
>
Oddly enough, str(tdobject) does what you want.
--
Posted via a free Usenet
Basically I used the datetime module and timedelta objects to calculate
a difference between two times. Now I'm trying to figure out how I make
that time delta a string HH:MM:SS to show elapsed time. I've spent tons
of time looking at the module's documentation but I'm not seeing how
those me