//php获取今日开始时间戳和结束时间戳
$beginToday=mktime(0,0,0,date('m'),date('d'),date('Y'));
$endToday=mktime(0,0,0,date('m'),date('d')+1,date('Y'))-1;
echo "今日开始时间戳:".$beginToday.'----'.date('Y-m-d H:i:s',$beginToday).'<br>';
echo "今日结束时间戳:".$endToday.'----'.date('Y-m-d H:i:s',$endToday).'<br>';
//php获取昨日起始时间戳和结束时间戳
$beginYesterday=mktime(0,0,0,date('m'),date('d')-1,date('Y'));
$endYesterday=mktime(0,0,0,date('m'),date('d'),date('Y'))-1;
echo "昨日开始时间戳:".$beginYesterday.'----'.date('Y-m-d H:i:s',$beginYesterday).'<br>';
echo "昨日结束时间戳:".$endYesterday.'----'.date('Y-m-d H:i:s',$endYesterday).'<br>';
//php获取上周起始时间戳和结束时间戳
$beginLastweek=mktime(0,0,0,date('m'),date('d')-date('w')+1-7,date('Y'));
$endLastweek=mktime(23,59,59,date('m'),date('d')-date('w')+7-7,date('Y'));
echo "上周开始时间戳:".$beginLastweek.'----'.date('Y-m-d H:i:s',$beginLastweek).'<br>';
echo "上周结束时间戳:".$endLastweek.'----'.date('Y-m-d H:i:s',$endLastweek).'<br>';
//php获取本月起始时间戳和结束时间戳
$beginThismonth=mktime(0,0,0,date('m'),1,date('Y'));
$endThismonth=mktime(23,59,59,date('m'),date('t'),date('Y'));
echo "本月开始时间戳:".$beginThismonth.'----'.date('Y-m-d H:i:s',$beginThismonth).'<br>';
echo "本月结束时间戳:".$endThismonth.'----'.date('Y-m-d H:i:s',$endThismonth).'<br>';
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn