How to convert a timedelta object to a string?

Carl J. Van Arsdall cvanarsdall at mvista.com
Thu Sep 14 17:25:01 EDT 2006


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 want.
>
>   
Well, kinda, although I can work with this, str(tdobject) returns a 
string that looks like:

-1 day, 7:34:32



Granted, I can parse that, I was looking for a way to just get the 
actual duration.  But for now I'll just parse the string, thanks.

-c



-- 

Carl J. Van Arsdall
cvanarsdall at mvista.com
Build and Release
MontaVista Software




More information about the Python-list mailing list