Categories
How to get number of months?
How to subtract the current date from the date and get the number of months of difference between them?
$date = 02.12.2019; now = date('d.m.Y'); $d2 = strtotime($date); $d1 = strtotime($now); $diff = $d2-$d1;
Answer the question
In order to leave comments, you need to log in
Something like this for example
$now = new DateTime('now'); $date = new DateTime('2019-05-01'); $diff = $now->diff($date); $interval = $diff->format('%m');
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question