Re: Find the last friday of each month.

From: Date: Sun, 26 Oct 2003 21:35:07 +0000
Subject: Re: Find the last friday of each month.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-167650@lists.php.net to get a copy of this message
> OrangeHairedBoy wrote: > >Basically, I just want to show what the last friday of the month is, and if > >that date has already passed, show the last friday of the next month. > > You can get the number of days in a month from date() > > Now you know that the last Friday of the month will be at most 7 days > from the end of the month, > loop through the last 7 days of the month and determine what date it is > using the date() function. > Compare the date to determine if it is Friday or not. > > And then add in the check for if the date has passed or not. The last friday of the following month will be the last friday of the current month + the number of day in the current month > 28 ( date("t") - 28 ). -Bob

« previous php.general (#167650) next »