I tried to find out difference between today date and specific day with format Ymd
.
How to check whether specific day is greater than 30 days from today?
For example:
$date1 = '20160315'; // 2016-03-15
$date2 = '20160115'; // 2016-01-15
I tried to find out difference between today date and specific day with format Ymd
.
How to check whether specific day is greater than 30 days from today?
For example:
$date1 = '20160315'; // 2016-03-15
$date2 = '20160115'; // 2016-01-15
Try this
$date1=date_create('20160315');
$date2=date_create('20160115');
$diff=date_diff($date1,$date2);
$days = $diff->format("%a");
if($days > 30) do something