Answers for "month and years calculator php"

PHP
0

php Calculate the number of months between two dates

$date1 = '2000-01-25';
$date2 = '2010-02-20';

$ts1 = strtotime($date1);
$ts2 = strtotime($date2);

$year1 = date('Y', $ts1);
$year2 = date('Y', $ts2);

$month1 = date('m', $ts1);
$month2 = date('m', $ts2);

$diff = (($year2 - $year1) * 12) + ($month2 - $month1);
Posted by: Guest on December-11-2021
-1

get month days in php

echo cal_days_in_month(CAL_GREGORIAN, 8, 2009);
Posted by: Guest on October-19-2020

Code answers related to "month and years calculator php"

Browse Popular Code Answers by Language