note 76112 added to function.strtotime
| From: | IanFieggen at osu1 dot php dot net | Date: | Sun, 01 Jul 2007 02:54:23 +0000 |
| Subject: | note 76112 added to function.strtotime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128120@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 203.16.234.91
Probable Submitter: 124.176.134.221
----
Manual Page -- http://www.php.net/manual/en/function.strtotime.php
Edit -- https://master.php.net/note/edit/76112
Del: integrated -- https://master.php.net/note/delete/76112/integrated
Del: useless -- https://master.php.net/note/delete/76112/useless
Del: bad code -- https://master.php.net/note/delete/76112/bad+code
Del: spam -- https://master.php.net/note/delete/76112/spam
Del: non-english -- https://master.php.net/note/delete/76112/non-english
Del: in docs -- https://master.php.net/note/delete/76112/in+docs
Del: other reasons-- https://master.php.net/note/delete/76112
Reject -- https://master.php.net/note/reject/76112
Search -- https://master.php.net/manage/user-notes.php