1. 程式人生 > >php獲取當天的00:00:00~23:59:59

php獲取當天的00:00:00~23:59:59

 這是轉換後的格式:

$todayStart= date('Y-m-d 00:00:00', time()); //2016-11-01 00:00:00

$todayEnd= date('Y-m-d 23:59:59', time()); //2016-11-01 23:59:59

這是時間戳格式:

$year = date("Y");
$month = date("m");
$day = date("d");
$start = mktime(0,0,0,$month,$day,$year);//當天開始時間戳
$end= mktime(23,59,59,$month,$day,$year);//當天結束時間戳