note 76112 deleted from function.strtotime by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 07:59:55 +0000 |
| Subject: | note 76112 deleted from function.strtotime by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-196705@lists.php.net to get a copy of this message | ||
Note Submitter: Ian Fieggen
----
To calculate the last Friday in the current month, use strtotime() relative to the first day of next
month:
<?php
$lastfriday=strtotime("last Friday",mktime(0,0,0,date("n")+1,1));
?>
If the current month is December, this capitalises on the fact that the mktime() function correctly
accepts a month value of 13 as meaning January of the next year.