/**
* @Author: 小破孩嫩
* @Email: 3584685883@qq.com
* @Time: 2021/6/9 10:21
* @param $year
* @Description:获取任意一年的每个月的开始和结束的时间戳
*/
public function getMonthBetweenTimestampByYear($year = ''){
if(empty($year)){
$year = date('Y',time());
}
$month = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'];
foreach($month as $key => $val){
$month_start = strtotime($year.'-'.$val);//指定月份月初时间戳
$month_end = mktime(23, 59, 59, $val+1, 00,$year);//指定月份月末时间戳
$month_s_e[] = ['start' => $month_start, 'end' => $month_end];
}
return $month_s_e;
}
版权属于:
小破孩
作品采用:
《
署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)
》许可协议授权
评论