Actually this is a really common question.  The thing you need to remember
is that when you use localtime(), what you are really saying is
localtime(time).  Local time takes the number of seconds since the year 1970
and translates it into the array you are using UNLESS YOU SPECIFY ANOTHER
DATE IN THE SAME FORMAT.  Therefore you can do this:

localtime(time - (60 * 60 * 24)); #60 sec, 60 min, 24 hrs.

which translates to 

localtime(time - 86400); # the number of seconds in one day, 
                         # which is yesterday.

So taking this info, it is easy to extrapolate that

localtime(time - 86400 * 2);

is the date two days ago. 

Note:  the * operator is calculated before the - operator, otherwise you
would have to use parenthesis to force the operation first.

-----Original Message-----
From: Tara Calishain
To: [EMAIL PROTECTED]
Sent: 4/25/02 10:57 PM
Subject: Backing up two days from localtime

Howdy,

I need to back up two days from localtime and I can't figure out how to
do
it. Currently I'm doing this just so I can work out the rest of the
program:

($day, $month, $year) = (localtime) [3,4,5]; #getting your local time 
information
$realday = $day-2;
if ($realday<1) {$realday = 30} else {$realday = $day-2};

..... but that's a very cheesy and occasionally wrong workaround.

This is probably a stupid question hopefully not the stupidest question 
you've ever
seen. I hope.

Thanks,

Tara


-- 
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