On Fri, 19 Dec 2003, Marco Marongiu wrote:
> Date::Iterator - Iterate over a range of dates
I like it!
> # This puts all the dates from Dec 1, 2003 to Dec 10, 2003 in @dates
> # @dates will contain ([2003,12,1],[2003,12,2] ... [2003,12,10]) ;
> my $i1 = Date::Iterator->new(from => [2003,12,1], to =>
> [2003,12,10]) ;
> my @dates1 ;
> push @dates,$_ while $_ = $i1->next ;
I recently needed to handle the same thing, but also needed to be able to
handle hourly steps. Would it be possible to add support for something
like the following:
my $i1 = Date::Iterator->new(from => [2003,12,1,10],
to => [2003,12,10,23] );
and have it return arrays (or refs) with [yyyy,mm,dd,hh] back?
This could also be expanded in both directions, to handle:
my $i1 = Date::Iterator->new(from => [2003,12],
to => [2004,3] );
and:
my $i1 = Date::Iterator->new(from => [2003,12,1,10,6],
to => [2003,12,2,3,55] );
The latter to be a range of minutes from 2003-12-01 10:06 to
2003-12-02 3:55.
I realize that probably wasn't your origonal intention at all, but
that would be really handy.
BTW - I'd be happy to contribute to Date::Iterator to add support for the
above type of scenarios if you'd like.
--
Josh I.