calculating difference between 2 dates

wxdqz

New Member
Im trying to fill a field in a php generated html table populated by the difference in days between a date from a field in my DB and todays date.

any pointers much appreciated

//the code ive tried is as follows

while ($Row = mysql_fetch_array ($Result)) {

$today = date ("Y.m.d");//todays date in the same format as the stored data
//$oldtoday = ($Result['dateinv']);//data im trying to use as a comparison

$outcome = ($today - ($Result['dateinv']));//a feeble attempt at subtracting one from the other

print("<tr bgcolor=#66CCFF>\n");
print("<td align=center>$Row[custid]</td>\n");
print("<td align=center><a href=http://www.phpbuilder.com/board/archive/index.php/\"updateinv.php?invoiceno=$Row[invoiceno]&amount=$Row[amount]\">$Row[invoiceno]</a></td>\n");
print("<td align=center>?Row[amount]</td>\n");
print("<td align=center>$Row[dateinv]</td>\n");
print("<td align=center>$Row[paygot]</td>\n");
print("<td align=center><a href =\"invcreator.php?custid=$Row[custid]&invoiceno=$Row[invoiceno]\" >Create</a></td>\n");
print("<td align=center>$outcome</td>\n");
print("</tr>\n");


regards and tia

rob
 
Back
Top