Re: Find the last friday of each month.
| From: | Bob Hockney | Date: | Sun, 26 Oct 2003 22:39:51 +0000 |
| Subject: | Re: Find the last friday of each month. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167655@lists.php.net to get a copy of this message | ||
Bob wrote:
> 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 ).
OOPS! I meant the The last friday of the following month will be the *date*
of the last friday of the current month MINUS the number of day in the current
month > 28 ( date("t") - 28 ), + 7 days if not in last 7 of month.
i.e.,
Last friday of October is 31
Last friday of November is 31 - (31 - 28) = 28.
Last friday of December is 28 - (30 - 28) = 26.
Last friday of January is 26 - (31 - 28) = 23 + 7 = 30
because 23rd is not in last 7.
Last friday of February is 30 - (31 - 28) = 27.
etc...
-Bob