need a little help with time

Diez B. Roggisch deets at nospam.web.de
Fri Aug 26 10:52:16 EDT 2005


nephish at xit.net wrote:
> Hey there.
> i have a time string (created with strftime) then read from a file,
> i am having some trouble understanding how to get the difference
> between times.
> i know i can structime(timestring) and get a time value, but i dont
> know how to manipulate it.
> 
> basically, if i have string 2005-08-24 09:25:58
> and another string 2005-08-24 09:28:58
> 
> how can i tell how many minutes, hours, seconds, days, months etc..
> have passed between the first string and the second ?
> 
> or, if there is a good tutorial on this kind of thing, please post a
> url.

Look at the module datetime.

Diez



More information about the Python-list mailing list