I have a relatively simple script that needs to get two separate dates,
today's date, and yesterday's date. The dates are in mmddyy format.
Everything works great on days 2 - 31 of the month, but on the first of
the month yesterday's date is not correct. For example, on October 1,
2003 the variable $dateyesterday was "100003" when it needed to be 093003.
Obviously, there is no 100003. Is there a way to deal with this problem
on the first day of every month?
Here is the script:
################## BEGIN SCRIPT ################################
my ($mday, $mon, $year) = (localtime)[3..5];
my $datetoday = sprintf ("%02d%02d%02d", ++$mon, $mday, $year-100);
print ("the value of datetoday is $datetoday\n");
my ($yesterdaymday, $yesterdaymon, $yesterdayyear) = (localtime)[3..5];
my $dateyesterday = sprintf ("%02d%02d%02d", ++$yesterdaymon,
$yesterdaymday-1, $yesterdayyear-100);
print ("the value of datetoday is $dateyesterday\n");
################### END SCRIPT #####################################
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]