I want to compare current date\'s day and month with subscription date\'s day and month only. ex.current date(d-m) = 3-6 and I want compare it with any other
I think, more elegant way to compare, especially when you have a full date with time is diff
function of Datetime
class:
$d1 = new Datetime();
$d2 = new Datetime('+3 months +2 days +3 hours');
$diff = $d1->diff($d2);
var_dump($diff->d); // 2
var_dump($diff->m); // 2
// or have a comparison as a string
var_dump($diff->format('Difference is in %R%a days'));
// output: Difference is in 63 days
Enjoy! Link to doc