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, De
And if you want the number of days:
py> d = datetime.datetime(2006,5,24,16,34) -
datetime.datetime(2006,5,23,12,1)
py> d.days
1
py> d = datetime.datetime(2006,5,24,16,34) -
datetime.datetime(2006,5,23,19,1)
py> d.days
0
--
http://mail.python.org/mailman/listinfo/python-list
> 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?
Hi Lad,
you could do this:
>>> a = datetime.datetime(2006,
Lad skrev:
> How can I find out the date/time difference ( in days) of such
> two fields?
Did you try to subtract one value from the other?
Mvh,
--
Klaus Alexander Seistrup
SubZeroNet, Copenhagen, Denmark
http://magnetic-ink.dk/
--
http://mail.python.org/mailman/listinfo/python-list
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.
--
http://mail.python.org/mailman/listinfo/python-list
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
--
http://mail.python.org/mailman/listinfo/python-lis