Datetime objects
Lad
python at hope.cz
Wed Aug 2 08:16:08 EDT 2006
Sybren Stuvel wrote:
> Lad enlightened us with:
> > How can I find days and minutes difference between two datetime
> > objects?
> > For example If I have
> > b=datetime.datetime(2006, 8, 2, 8, 57, 28, 687000)
> > a=datetime.datetime(2006, 8, 1, 18, 19, 45, 765000)
>
> diff = b - a
Ok, I tried
>>> diff=b-a
>>> diff
datetime.timedelta(0, 52662, 922000)
>>> diff.min
datetime.timedelta(-999999999)
which is not good for me.
So I tried to use toordinal like this
diff=b.toordinal()-a.toordinal()
but I get
diff=1
Why?
where do I make a mistake?
Thank you for help
More information about the Python-list
mailing list