I guess that you want to count the number of days between date 1 and date 2. This isn't as easy as it sounds - here's a snippet i found, can't remember who wriote it though.
function count_days($dat2,$dat1){
/* Dat1 and Dat2 passed as "YYYY-MM-DD" */
$tmp_dat1 = mktime(0,0,0,
substr($dat1,5,2),substr($dat1,8,2),substr($dat1,0,4));
$tmp_dat2 = mktime(0,0,0,
substr($dat2,5,2),substr($dat2,8,2),substr($dat2,0,4));
$yeardiff = date('Y',$tmp_dat1)-date('Y',$tmp_dat2);
/* a leap year in every 4 years and the days-difference */
$diff = date('z',$tmp_dat1)-date('z',$tmp_dat2) +
floor($yeardiff /4)*1461;
/* remainder */
for ($yeardiff = $yeardiff % 4; $yeardiff>0; $yeardiff--)
{
$diff += 365 + date('L',
mktime(0,0,0,1,1,
intval(
substr(
(($tmp_dat1>$tmp_dat2) ? $dat1 : $dat2),0,4))
-$yeardiff+1));
}
return $diff;
}
It should factor in stuff like leap years.