when i use this to get data from DB
<?
while ( $row = mysql_fetch_array($result) )
{ echo ("<font face=\"arial\" size=\"2\">". $row["FromDate"] ."<br>");
}
?>
which gives me
2002-03-01
2002-02-03
2002-01-01
How to find the difference between todays date and each of the above dates, and also display them
how to use the below code, for finding date difference from the array
<?
$Today = date('d/m/Y');
echo $Today;
$FromDate = "$day/$mon/$year";
//--start calculating days--//
$date_el_Today = explode("/" ,$Today);
$date_el_FD = explode("/" ,$FromDate);
$Tday = mktime (0, 0,0 ,$date_el_Today [1], $date_el_Today [0],$date_el_Today [2]);
$FD = mktime (0, 0,0 ,$date_el_FD [1], $date_el_FD [0],$date_el_FD [2]);
$diff = ($FD-$Tday);
$d = getdate($diff);
$d['year'] = $d['year'] - 1970; // get rid of Epoch time
$days = $d['year']*365 + $d['yday'];
echo $days;
//--end calculating days--//
?>
thanks,