Then you should look into sprintf(), which just returns the result. $oneHourAgo = sprintf("%02d",$hour--);
I think. -----Original Message----- From: Kevin Old To: [EMAIL PROTECTED] Sent: 7/29/02 8:33 AM Subject: Calculate previous hour? Hello all, Well, I've got a very simple problem and can't seem to get the answer I want. Basically I just want to find the previous hour in one of my scripts. This code does it, but I need to maintain the format "09". $hour = (localtime)[2]; $hour--; #adjust hour to previous I know about using printf, but I don't need to print this value. I need to use it as a variable. I've even tried stuff like this: $prevhour = &DateCalc("today","- 1hour","%H"); print "prev hour: $prevhour\n"; but it gives me the whole date. It seems to me that to achieve something so simple wouldnt' be so difficult. Any ideas? Thanks, Kevin -- 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]