Just add teh sprintf to the else block too.

else
{
$year = sprintf("%02d",$now[5] % 100);
}

-- Rex

-----Original Message-----
From: Glenn Cannon [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 08, 2001 10:47 AM
To: [EMAIL PROTECTED]
Subject: Problem with IF statement


I am trying to force the current year to be show as a two digit 
number, with
leading zero if necessary.
Here is what I am using currently, what am I doing wrong?
 
#Code On

@now = localtime;
if (length($now[5] % 100) == l)
{
$year = sprintf("%02d", $now[5] % 100)
}
else
{
$year = $now[5] % 100
}

#Code Off

Glenn Cannon
[EMAIL PROTECTED]
Level II Certified DCI Judge
'There is no spoon.'
www.eventsbeyondbelief.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to