[Zope3-dev] Dates and times

Fred L. Drake, Jr. fred@zope.com
Fri, 15 Nov 2002 10:33:01 -0500


Barry A. Warsaw writes:
 > 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

Yes.

 > 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.

What you're looking for is the datetime.timedelta type, which can
express "36 hours and 27 minutes", or "4 hours and 30 minutes".


  -Fred

-- 
Fred L. Drake, Jr.  <fred at zope.com>
PythonLabs at Zope Corporation