Yeah I think that would work, but (as an example..) if the upcoming Friday
was on the 1st of next month, and today was Wednesday the 30th, would it
think that Friday was on the 32nd?

-----Original Message-----
From: Andrew Rush [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 27, 2001 12:59 PM
To: Adam Plocher
Subject: Re: [PHP] finding Friday's date


on 2/27/01 03:39 PM, Adam Plocher at [EMAIL PROTECTED] wrote:

> Could somebody show me an example of a script that will find out the date
of
> each upcoming Friday, thanks.

something like:

$days=array("Saturday", "Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday");

$today=date(l);
$todayNum=date(j);

if($today == "Friday") {

    fDate=date("m-d-Y");

} else {

    $todayKey=array_keys($days, $today);

    for($i=$todayKey; $i < count($days); $i++)) {

        $daysTilFri=$i;

    }

    $friday=$todayNum+$daysTilFri;

    $friday=date("m-$friday-Y");

}

maybe? untested.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to