in reply to Midnight wraparound.
my $starttime = DateTime->now(); my $endtime = DateTime->now()->add( hours => 3); my @between = grep { DateTime->compare($_->when(), $starttime) >= 0 and DateTime->compare($endtime, $_->when) >= 0 } @eventtimes;
Well, something like that. The ->when() method may not be how you get a DateTime object for one of your events, but you can adjust that part to match your setup. Also, the >=0 condition may not be right, if you want open endpoints for instance. (The return value of compare is the same as that of the cmp and <=> operators would be if the comparison were string or numeric, respectively.)
|
|---|