datetime.iterdate

Michael Hudson mwh at python.net
Wed Jul 14 08:18:58 EDT 2004


Andrew Durdin <adurdin at gmail.com> writes:

> On Mon, 12 Jul 2004 11:47:04 -0700, Robert Brewer <fumanchu at amor.org> wrote:
> > 
> > def daterange(start, end):
> >     for day in xrange((end - start).days):
> >         yield start + datetime.timedelta(day)
> 
> How about a more general class to represent a date/time range
> (essentially a timedelta with a starting datetime), with methods
> returning lists/generators for different size increments. 

Isn't this sort of thing what dateutil.rrule is for?

Cheers,
mwh

-- 
  Hey, if I thought I was wrong, I'd change my mind.  :)
                                    -- Grant Edwards, comp.lang.python



More information about the Python-list mailing list