$today = strtotime(date('Y-m-d', time()));//零点时间戳
//今日
$res['today'] = $this->getData($today,time());
//获取昨日起始时间戳和结束时间戳
$beginYesterday=mktime(0,0,0,date('m'),date('d')-1,date('Y'));
$endYesterday=mktime(0,0,0,date('m'),date('d'),date('Y'))-1;
$res['yesterday'] = $this->getData($beginYesterday,$endYesterday);
//本周
$beginThisWeek = mktime(0,0,0,date('m'),date('d')-date('w')+1,date('y'));
$endThisWeek=time();
$res['this_week'] = $this->getData($beginThisWeek,$endThisWeek);
//本月
$beginThisMonth = mktime(0, 0, 0, date('m'), 1, date('Y'));
$endThisMonth = mktime(23, 59, 59, date('m'), date('t'), date('Y'));
$res['this_month'] = $this->getData($beginThisMonth,$endThisMonth);
//上周
$beginLastWeek = strtotime(date("Y-m-d", strtotime('monday last week')));
$endLastWeek = strtotime(date("Y-m-d", strtotime('monday this week - 1 days')));
$res['last_week'] = $this->getData($beginLastWeek,$endLastWeek);
//上月
$beginLastMonth=strtotime(date('Y-m-01', strtotime('-1 month')));
$endLastMonth=strtotime(date('Y-m-t', strtotime('-1 month')));
$res['last_month'] = $this->getData($beginLastMonth,$endLastMonth);
php本周上周本月上月起始终止时间戳
原创
©著作权归作者所有:来自51CTO博客作者flysnownet的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:MySQL按天统计最近七天数据
下一篇:数据结构算法题
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
day.js 时间戳
day.js 的时间戳 希望大家可以补充
时间段 时间戳 时间处理 -
转载PHP获取上周、本周、上月、本月、本季度、上季度时间方法
theme: github本文转载于作者:不
php linux python thinkphp shell -
GREP 往后
GREP GREP Section: User Commands (1) NAME grep, egrep, fgrep -&
GREP 往后 正则表达式 action whitespace unix