note 91241 deleted from function.checkdate by danbrown
| From: | danbrown@php.net | Date: | Mon, 01 Jun 2009 12:52:58 +0000 |
| Subject: | note 91241 deleted from function.checkdate by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156215@lists.php.net to get a copy of this message | ||
Note Submitter: php at thoughtfactory dot co dot za
----
Alternate "non-loop" versions of GetLastDayofMonth:
function EndOfMonth($date) {
$arr = getdate($date);
$d = date('t',$date);
return mktime(0,0,0,$arr['mon'],$d,$arr['year']);
}
or
// define('ONE_DAY', 24*60*60);
function EndOfMonth($m, $y) {
$dt = mktime(0,0,0,$m,1,$y);
$d = date('t', $dt);
return $dt + $d - ONE_DAY;
// return mktime(0,0,0,$m,$d,$y);
}