[Omaha.pm] SQL . sprintf

Sean Baker pbaker at omnihotels.com
Tue Aug 16 13:51:34 PDT 2005


Depending on the database, and if you're only working with "Today" you
may not need to use any Class::Date spinoffs:



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

 

 

________________________________

From: omaha-pm-bounces at pm.org [mailto:omaha-pm-bounces at pm.org] On Behalf
Of Kenneth Thompson
Sent: Tuesday, August 16, 2005 3:17 PM
To: omaha-pm at pm.org
Subject: 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)

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


More information about the Omaha-pm mailing list