Click to See Complete Forum and Search --> : Difference between two dates in days


firman
07-10-2007, 02:42 PM
I am trying to select data out of my MYSQL db that is more than 180 days old from today's date.

$query = "SELECT *,DATEDIFF($todays_date, LAST_MAINT_DATE) < 180 FROM inventory_maint ORDER BY $row_name ASC";

I have tried the above...with no success... LAST_MAINT_DATE and todays date is formated as YYYY-MM-DD. How can I have all data display when the LAST_MAINT_DATE is over 180 days old?

I am trying to use this in a PHP program.

bubbisthedog
07-10-2007, 05:25 PM
select [field list]
from inventory_maint
where datediff($todays_date, LAST_MAINT_DATE) > 180
order by $row_name asc