File: /home/asjudine/www/datediff.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Date Diff</title>
</head>
<body>
<?PHP
function dateDiffe($dformat, $endDate, $beginDate)
{
$date_parts1=explode($dformat, $beginDate);
$date_parts2=explode($dformat, $endDate);
$start_date=gregoriantojd($date_parts1[0], $date_parts1[1], $date_parts1[2]);
$end_date=gregoriantojd($date_parts2[0], $date_parts2[1], $date_parts2[2]);
return $end_date - $start_date;
}
$date1="07-11-2008";
$date2="09-12-2008";
echo "La diferencia entre " . $date1 . " y " . $date2 . " en dias es: " . dateDiffe("-", $date2, $date1) . ".";
?>
</body>
</html>