PHP获得本周、本月、上周、上月起始时间戳
<?php // 今日起止时间 $beginToday = mktime(0,0,0,date('m'),date('d'),date('y')); $now = 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; //本周起止时间 $beginThisweek = mktime(0,0,0,date('m'),date('d')-date('w')+1,date('y')); $now = time(); //上一周起止时间 $beginLastweek = mktime(0,0,0,date('m'),date('d')-date('w')-6,date('y')); $endLastWeek = mktime(23,59,59,date('m'),date('d')-date('w'),date('y')); //本月起至时间 $beginThismonth = mktime(0,0,0,date('m'),1,date('y')); $now = time(); //近三个月起止时间 $beginLastThreemonth = mktime(0,0,0,date('m')-3,1,date('y')); $now = time(); ?>