遇到了一个需要某月最后一天的问题,经查php解决方案如下:
1 2 3 4 5 6 |
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); } |
sharpbai's tech blog~
遇到了一个需要某月最后一天的问题,经查php解决方案如下:
1 2 3 4 5 6 |
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); } |