Calculating the days

admin

Administrator
Staff member
Hi All

Just a quickie

I'm trying to calculate how far past a certain day the date today is

so far i've got

$sql = ("SELECT show_date FROM advent");
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$show_date = $row["show_date"];

$result = mysql_query("SELECT (TO_DAYS(\"$date_today\") - TO_DAYS(\"show_date\")) AS difference");
$row = mysql_fetch_array($result);
$difference = $row['difference'];

tha value in the field show_date is 2000-11-27

I was hoping for a value of 2 to be returned.

It's coming back with nothing, hhmmmmm

Have only just stumbled on the TO_DAYS function, anyone got any advice on whats wrong
 
Back
Top