[Omaha.pm] SQL . sprintf

Jay Hannah jay at jays.net
Tue Aug 16 16:07:12 PDT 2005


On Aug 16, 2005, at 3:16 PM, Kenneth Thompson wrote:
> After-After
>     $filter .= " AND extend(arrival_date,year to day) >= ‘" .
>        new Control::DateTime->format("%Y-%02d-%02d") . "'";

Whoah... That *does* compile. new() is called, then format()... Scary. 
I wouldn't actually use that if I were you. Just my $0.02.

Regardless, I think that format() string is garbage in Class::Date 
land...

Code:
--------
use Control::DateTime;

# Bogus:
print new Control::DateTime->format("%Y-%02d-%02d");
print "\n";
# Good:
print new Control::DateTime->format("%Y-%m-%d");
print "\n";
--------

Output:
--------
2005-16-16
2005-08-16
--------

Ya can't mix printf format stuff and Class::Date format stuff. They're 
different beasties.

Cheers,

j



More information about the Omaha-pm mailing list