http://www.perlmonks.org?node_id=138093


in reply to (jeffa) Re: DBI SQL Query Question
in thread DBI SQL Query Question


Additionally, to get the zero-padding functionality of date(1)'s %m and %d, use sprintf().
my $month = sprintf ("%02d", (localtime)[4]+1); my $day = sprintf ("%02d", (localtime)[3]);

Two other options for formatting your date/time are: POSIX's strftime, and Date::Format.