- date_diff: documentation ( source)
- date_create: documentation ( source)
- getdate: documentation ( source)
<?php
$dt1 = getdate();
$dt2 = getdate();
$date1 = date_create("".$dt1."");
$date2 = date_create("".$dt2."");
$dateDiff = date_diff($date2, $date1);
$probDays = $dateDiff->days;
$probMon = $dateDiff->m;
$probYear = $dateDiff->y;
$month = $probDays / 30;
$totLeave = $month * 1;
if($month > $probmon)
{
$totLeave = $totLeave + 1;
}
?>