feiyuanqiu
2015-08-24 15:15:04 +08:00
//1.今天的时间戳段
$todayBegin = strtotime ('today');
$todayEnd = strtotime ('tomorrow')-1;
//2.本周的时间戳段
$weekBegin = strtotime ('this monday');
$weekEnd = strtotime ('next monday')-1;
//3.本月的时间戳段
$monthBegin = mktime (0, 0, 0, date ('m'), 1 );
$monthEnd = mktime (0, 0, 0, date ('m', strtotime ('next month')), 1 )-1;
//4.今年所有月份的时间戳段
$monthInTheYear = array ();
foreach (range (1, 12 ) as $month ) {
$begin = mktime (0, 0, 0, $month, 1 );
$end = strtotime (date ('Y-m-d', $begin ) . '+1 month')-1;
$monthInTheYear[$month] = array (
'begin' => $begin,
'end' => $end,
);
}
exit;