Friday, August 31, 2018

[PHP] 找出月份的第一天及最後一天

//指定日期
$d = '2018-02-15';
$startdate = date('Y-m-01', strtotime($d));
$enddate = date('Y-m-t', strtotime($d));

//當下日期
$startdate = date('Y-m-01');
$enddate = date('Y-m-t');

No comments:

Post a Comment