note 53253 deleted from function.date by aidan
| From: | aidan@php.net | Date: | Sun, 31 Jul 2005 12:34:11 +0000 |
| Subject: | note 53253 deleted from function.date by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-92819@lists.php.net to get a copy of this message | ||
Note Submitter: cdblog at gmail dot com
----
<?php
/**
* @return void
* @desc with this function you can get how many weeks in the month.
* the resource's link is http://php.clickz.cn/articles/date/getWeekNum.html
* you can find the update version at my php blog: http://php.clickz.cn/
*/
function getWeekNum($year = 2005, $month = 12) {
if (date("w",mktime(0,0,0,$month,1,$year)) > 4) {
if (checkdate($month,31,$year) == true ) {
return 6;
} elseif (checkdate($month,31,$year) == false ) {
if (checkdate($month,30,$year) == false ) {
return 6;
} else {
return 5;
}
} else {
return 5;
}
} elseif ((date("w",mktime(0,0,0,$month,1,$year)) == 0) AND ($month == 2) AND
(checkdate($month,29,$year) == false)) {
return 4;
} else {
return 5;
}
}
?>