我如何检查给定日期(即4/2017)是否在未来6个月内?6个月内的PHP日期
例如:
4/2017 true
8/2017 false
5/2017 true
我现在有:
$datum = explode(': ', $given_date); // Separate date from string
$datum = str_replace('/', '-', $datum[1]); // Given format month/year
$datum = strtotime('01-'.$datum); // Given only month/year
$limit_datum = strtotime('+6 months');
但现在我倾斜,并不能得到怎样比较吧...
使用的字符串['DateTime'(https://secure.php.net/DateTime)。 –