Let me introduce how to use php to get the codes of the first and last day of a month. Friends in need can refer to it.
Use php to get the first and last day of a month. Code: <?php /** * php date函数示例 * 取一个月的第一天与最后一天 * by bbs.it-home.org */ function getthemonth($date) { $firstday = date('Y-m-01', strtotime($date)); $lastday = date('Y-m-d', strtotime("$firstday +1 month -1 day")); return array($firstday, $lastday); } ?> Copy after login |