例如我們想知道 2014-12-28 與 2015-01-01 間差了幾個月份,語法很簡單...
$sd = $_POST['search_startdate'];
$ed = $_POST['search_enddate'];
$diff_month = (date('Y', strtotime($ed)) - date('Y', strtotime($sd))) * 12 + (date('m', strtotime($ed)) - date('m', strtotime($sd)));
No comments:
Post a Comment