How to find out a date/time difference

Klaus Alexander Seistrup klaus at seistrup.dk
Wed May 24 17:40:47 CEST 2006


Nico Grubert skrev:

> you could do this:
>
> >>> a = datetime.datetime(2006, 5, 24, 16, 1, 26)
> >>> b = datetime.datetime(2006, 5, 20, 12, 1, 26)
> >>> a-b
> datetime.timedelta(4)
> # 4 days

Or

#v+

>>> print (a-b).days
4
>>> 

#v-

Mvh, 

-- 
Klaus Alexander Seistrup
SubZeroNet, Copenhagen, Denmark
http://magnetic-ink.dk/



More information about the Python-list mailing list