[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] SQL . sprintf



I’m beginning to really like perl...

 

Before

    my @T = Date::Calc::Today;

    $filter .= " AND extend(arrival_date,year to day) >= '" .

       sprintf("%04d-%02d-%02d",$T[0..2]) . "'";

 

After

    $filter .= " AND extend(arrival_date,year to day) >= " .

       sprintf("'%04d-%02d-%02d'", Date::Calc::Today);

 

After-After

    $filter .= " AND extend(arrival_date,year to day) >= ‘" .

       new Control::DateTime->format("%Y-%02d-%02d") . "'";

 

(Control::DateTime being a massaged Class::Date)