[EMAIL PROTECTED] wrote:
All,
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?
also, why I ntoiced I had to may $month+1 otherwise it outputs a month
back. why is this?
thanks,
derek
printf ("%02d/%02d/%02d\n", $month + 1, $day, $year - 100);
# Only works when $year > 1999.
Try 'perldoc -f localtime' to learn why this works.
--
Flemming Greve Skovengaard FAITH, n.
a.k.a Greven, TuxPower Belief without evidence in what is told
<[EMAIL PROTECTED]> by one who speaks without knowledge,
4112.38 BogoMIPS of things without parallel.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>