View Full Version : datetime.timedelta

June 5th, 2010, 04:42 PM
I was reading about this (timedelta) class in the Python API and I cant really understand it enough to make use of it. What is this class for?

June 5th, 2010, 05:56 PM
Basically, you give it an interval of time, and it gives you back something that you can add to a datetime object, yielding a new datetime object.

June 5th, 2010, 06:20 PM
It's for representing differences in time through a standardized interface (though if you asked me, using an integer or double would've been smarter). So if you subtract two times, you get a timedelta. And you can compare two timedeltas to see which is greater, or if they are equal.

June 5th, 2010, 07:40 PM
Ok, thanks guys!