Saturday, August 9, 2008

Date Difference between two Dates in PHP

/* Date Difference between 2 Dates using PHP program */
$jd1 = gregoriantojd(date('m'), date('d'), date('Y'));
echo $jd1;

$jd2 = gregoriantojd(7, 27, date('Y'));
echo $jd2;

$date_diff = $jd1 - $jd2;

if ($date_diff < 0)
$date_diff *= -1; // abs

$gregorian = jdtogregorian($date_diff);
echo $date_diff;
?>

No comments:

Popular Posts