On Mon, 16 Aug 2004 [EMAIL PROTECTED] wrote:
I have this code:
my ($month, $day, $year) = (localtime)[4,3,5]; printf ("%02d/%02d/%02d\n", $month+1,$day,$year+1900);
which gives me
08/16/2004
what I want is 08/16/04. Should I just use Posix with strftime or is there a quicker way w/out having to load the Posix module?
POSIX is probably the "right" way to do it, though you could just use a regex to strip off the first two digits of the year:
$year =~ s/\d\d(\d\d)/$1/;
...or something to that effect.
also, why I ntoiced I had to may $month+1 otherwise it outputs a month back. why is this?
Because, as with many things in programming, it counts from zero, not one.
-- Chris Devers [EMAIL PROTECTED] http://devers.homeip.net:8080/blog/
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>