獲取當前月起始時間:
1.spa
$time=time();class
$start=date('Y-m-01',$time);//獲取指定月份的第一天date
$end=date('Y-m-t',$time); //獲取指定月份的最後一天im
2.di
$beginThismonth=mktime(0,0,0,date('m'),1,date('Y'));時間
$endThismonth=mktime(23,59,59,date('m'),date('t'),date('Y'));co
3.time
$start_time=Carbon::now()->startOfMonth();tar
$end_time=Carbon::now()->endOfMonth();
獲取當前星期:
$start=Carbon::now()->startOfWeek();
$end=Carbon::now()->endOfWeek();
獲取當日起始時間:
$start_time=Carbon::now()->startOfDay();
$end_time=Carbon::now()->endOfDay();
$beginToday=mktime(0,0,0,date('m'),date('d'),date('Y'));
$endToday=mktime(0,0,0,date('m'),date('d')+1,date('Y'))-1;