[Omaha.pm] SQL . sprintf

Kenneth Thompson kthompson at omnihotels.com
Tue Aug 16 13:16:46 PDT 2005


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)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/omaha-pm/attachments/20050816/0f094eb2/attachment.html


More information about the Omaha-pm mailing list