Connecting Tech Pros Worldwide Help | Site Map

How to find out a date/time difference

Lad
Guest
 
Posts: n/a
#1: May 24 '06
I use datetime class in my program and now
I have two fields that have the datetime format like this
datetime.datetime(2006, 5, 24, 16, 1, 26)

How can I find out the date/time difference ( in days) of such two
fields?


Thank you for help?
L

SaskMan
Guest
 
Posts: n/a
#2: May 24 '06

re: How to find out a date/time difference


Convert datetime.datetime(2006, 5, 24, 16, 1, 26) to an ordinal number
like:
datetime.datetime(2006, 5, 24, 16, 1, 26).toordinal()
and subtract them to get number of days.

Klaus Alexander Seistrup
Guest
 
Posts: n/a
#3: May 24 '06

re: How to find out a date/time difference


Lad skrev:
[color=blue]
> How can I find out the date/time difference ( in days) of such
> two fields?[/color]

Did you try to subtract one value from the other?

Mvh,

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


Similar Python bytes