note 84065 deleted from function.date by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 18:56:40 +0000 |
| Subject: | note 84065 deleted from function.date by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155191@lists.php.net to get a copy of this message | ||
Note Submitter: aplarsen
----
@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);
}
?>