//周日期 private function get_week($date) { $date_week = date("W",strtotime($date)); //上周日期是第几周 $week_num = date("w",strtotime($date)); //上周日期是星期几 if($week_num == 0) $week_num = 7; $starttime = strtotime($date) - ($week_num-1)*24*3600; //哪一周开始的时间(因为开始时间直接设置为了周一) $endtime = strtotime($date) + (7-$week_num +1)*24*3600 -1; //哪一周结束的时间 return array( ‘starttime‘ => $starttime, //上周的星期一 ‘endtime‘ => $endtime, //上周的星期日 ‘date‘ => $date, ‘week_num‘ => $week_num, //星期几 ‘date_week‘ => date("o",$starttime).‘-‘.$date_week //上周是第几周 ); }
原文地址:https://www.cnblogs.com/zwtqf/p/9653018.html
时间: 2024-11-17 05:33:22