note 84065 added to function.date
| From: | aplarsen at osu1 dot php dot net | Date: | Thu, 26 Jun 2008 08:12:44 +0000 |
| Subject: | note 84065 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-140827@lists.php.net to get a copy of this message | ||
@anonymous (12-Jun-2008 08:45):
date("t") returns the last day of the month, not the last working day of the month.
A cleaner example would be as follows:
<?php
function lastworkingday($date)
{
for($lastday=mktime(0,0,0,date("m",$date),
date("t",$date),date("Y",$date));
date("w",$lastday)==0 || date("w",$lastday)==6;
$lastday-=60*60*24);
return date("j",$lastday);
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 75.207.56.193
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- https://master.php.net/note/edit/84065
Del: integrated -- https://master.php.net/note/delete/84065/integrated
Del: useless -- https://master.php.net/note/delete/84065/useless
Del: bad code -- https://master.php.net/note/delete/84065/bad+code
Del: spam -- https://master.php.net/note/delete/84065/spam
Del: non-english -- https://master.php.net/note/delete/84065/non-english
Del: in docs -- https://master.php.net/note/delete/84065/in+docs
Del: other reasons-- https://master.php.net/note/delete/84065
Reject -- https://master.php.net/note/reject/84065
Search -- https://master.php.net/manage/user-notes.php