PHP獲取當月起始和結束時間戳

zhang_you_wu發表於2024-03-17

1.獲取當月起始和結束時間

$end_time  = strtotime(date('Y-m-t 23:59:59'));

$end_time  = strtotime(date('Y-m-t 23:59:59'));

2.獲取當月起始和結束時間戳

$start_time = strtotime(date('Y-m-01 00:00:00'));
$end_time  = strtotime(date('Y-m-t 23:59:59'));
echo "本月起始時間戳:".$start_time."<br>";
echo "本月結束時間戳:".$end_time."<br>";

相關文章