计算星期一的日期:
function getTheMonday($date) {
if (date ( 'N', strtotime ( $date ) ) == 1) {
return date ( 'Y-m-d', strtotime ( 'Monday', strtotime ( $date ) ) );
} else {
return date ( 'Y-m-d', strtotime ( 'last Monday', strtotime ( $date ) ) );
}
}
计算星期天的日期:
function getTheSunday($date) {
return date ( 'Y-m-d', strtotime ( 'Sunday', strtotime ( $date ) ) );
}