in reply to Want to use Date module
Why aren't you doing the date calculation in the database? That way you would only need to calculate the start and end date in Perl, or, if your database has date calculation functions, not even that:
or$sth = $dbh->prepare(<<SQL); SELECT * FROM mytable WHERE mydate between ? and ? ORDER BY mydate ASC SQL $sth->execute($start_date, $end_date); my $res = $sth->fetchall_arrayref;
$sth = $dbh->prepare(<<SQL); SELECT * FROM mytable WHERE ? - mydate <= 15 -- this should really use the date/time fun +ctions instead ORDER BY mydate ASC SQL $sth->execute($end_date); my $res = $sth->fetchall_arrayref;
|
|---|