I\'ve a function that returns url of 1 month before.
I\'d like to display current selected month, but I cannot use simple current month, cause when user clicks link
Date difference
$date1 = '2017-01-20'; $date2 = '2019-01-20'; $ts1 = strtotime($date1); $ts2 = strtotime($date2); $year1 = date('Y', $ts1); $year2 = date('Y', $ts2); $month1 = date('m', $ts1); $month2 = date('m', $ts2); echo $joining_months = (($year2 - $year1) * 12) + ($month2 - $month1);