in reply to MySQL query question...
I've also done the same thing in the past by using MySQL's from_days() function. This "works" but is probably not recommendeduse strict; use DateTime::Set; use DateTime::Format::MySQL; my ($d1,$d2) = (DateTime->now(),DateTime->now()->add(days=>7)); my $set = DateTime::Set->from_recurrence( after => $d1, before => $d2, recurrence => sub { $_[0]->truncate(to=>'day')->add(days=>1) }, ); my @dates = map { DateTime::Format::MySQL->format_date($_) } $set->as_list; # @dates now contains a list of MySQL looking date strings
# non-production-ready code follows my ($start_day,$end_day) = $dbh->selectrow_array("select to_days(now() +), to_days(now() + interval 7 day)"); my @dates = map { $dbh->selectrow_array("select from_days($_)") } $start_day .. $end_day;
|
---|