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

Re: [Omaha.pm] SQL . sprintf



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