今天:: $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‘));
php 获取今天,明天、本周、本周末、本月的起始时间戳和结束时间戳的方法
原文地址:http://itafei.blog.51cto.com/10862892/1955494