[Zope3-dev] Dates and times

Guido van Rossum guido@python.org
Fri, 15 Nov 2002 11:22:41 -0500


[Barry]
> Can we add time to a datetime?  Say I want something to happen at
> 4:30am every day, and I have a datetime for tomorrow at midnight.  I
> should be able to add 4 1/2 hours to that datetime to get the target
> datetime.  Or, say I want to add 36 hours and 27 minutes to a datetime
> that represents right now.  All those things should be possible right?
> I guess the latter example can't use a time value to represent "36
> hours and 27 minutes" if we're limited to a 24 hour range.

Please distinguish between intervals (which we already have) and times
(which are being proposed).  4 1/2 hours or 36 hours and 27 minutes
sound like intervals to me.  You can add those to a datetime and get
another datetime.  4:30am sounds like a time to me; the only operation
I propose on that is to *combine* (not "add") it with a date (not a
datetime), giving a datetime.

--Guido van Rossum (home page: http://www.python.org/~guido/)