时间格式
//今天
$today = date("Y-m-d");
//昨天
$yesterday = date("Y-m-d", strtotime(date("Y-m-d"))-86400);
//上周
$lastweek_start = date("Y-m-d H:i:s",mktime(0, 0 , 0,date("m"),date("d")-date("w")+1-7,date("Y")));
$lastweek_end = date("Y-m-d H:i:s",mktime(23,59,59,date("m"),date("d")-date("w")+7-7,date("Y")));
//本周
$thisweek_start = date("Y-m-d H:i:s",mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y")));
$thisweek_end = date("Y-m-d H:i:s",mktime(23,59,59,date("m"),date("d")-date("w")+7,date("Y")));
//上月
$lastmonth_start = date("Y-m-d H:i:s",mktime(0, 0 , 0,date("m")-1,1,date("Y")));
$lastmonth_end = date("Y-m-d H:i:s",mktime(23,59,59,date("m") ,0,date("Y")));
//本月
$thismonth_start = date("Y-m-d H:i:s",mktime(0, 0 , 0,date("m"),1,date("Y")));
$thismonth_end = date("Y-m-d H:i:s",mktime(23,59,59,date("m"),date("t"),date("Y")));
//本季度未最后一月天数
$getMonthDays = date("t",mktime(0, 0 , 0,date('n')+(date('n')-1)%3,1,date("Y")));
//本季度/
$thisquarter_start = date('Y-m-d H:i:s', mktime(0, 0, 0,date('n')-(date('n')-1)%3,1,date('Y')));
$thisquarter_end = date('Y-m-d H:i:s', mktime(23,59,59,date('n')+(date('n')-1)%3,$getMonthDays,date('Y')));
//2016-08-10这天 2个月后的日期
echo date("Y-m-d",strtotime("+2 month",strtotime("2016-08-10")));
//当前 3个月后的日期
echo date("Y-m-d",strtotime("+3 month",time()));
时间戳格式
//今天
$time_top = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$time_end = mktime(23, 59, 59, date('m'), date('d'), date('Y'));
//本周
$time_top = mktime(0,0,0,date("m"),date("d")-date("w")+1,date("Y"));
$time_end = mktime(23,59,59,date("m"),date("d")-date("w")+7,date("Y"));
//本月
$time_top = mktime(0, 0, 0, date('m'), 1, date('Y'));
$time_end = mktime(23, 59, 59, date('m'), date('t'), date('Y'));
网友评论