今天::
$start_time = mktime(0,0,0,date('m'),date('d'),date('Y'));
$end_time = mktime(0,0,0,date('m'),date('d')+1,date('Y'))-1;
明天:
$start_time = mktime(0,0,0,date('m'),date('d'),date('Y'))+86400;
$end_time = mktime(0,0,0,date('m'),date('d')+1,date('Y'))-1+86400;
本周:
$start_time = mktime(0,0,0,date('m'),date('d')-date('w')+1,date('Y'));
$end_time = mktime(23,59,59,date('m'),date('d')-date('w')+7,date('Y'));
本周末:
$start_time = mktime(0,0,0,date('m'),date('d')-date('w')+6,date('Y'));
$end_time = mktime(23,59,59,date('m'),date('d')-date('w')+7,date('Y'));
本月:
$start_time = mktime(0,0,0,date('m'),1,date('Y'));
$end_time = mktime(23,59,59,date('m'),date('t'),date('Y'));
一个月的开始和结束时间戳:
$date = "2017-09";
$date_arr = explode('-',$date);
$start_time = mktime(0,0,0,date($date_arr[1]),1,date($date_arr[0]));
$end_time = mktime(23,59,59,date($date_arr[1]),date('t',$start_time),date($date_arr[0]));
文章标题:php获取今天,明天、本周、本周末、本月的起始时间戳和结束时间戳的方法
文章转载:
http://chengdu.cdxwcx.cn/article/peoeij.html