This topic is locked

days between two dates

10/15/2005 5:05:59 PM
PHPRunner General questions
author

I have two date fields I want to calculate the number of days between these dates. when i write the sql statement due_date-date_given as days it subtracts the total number in date_given field from due-date for example if the date in due-date is 2005-10-29 and the date in date_given is 2005-09-15 it gives the result as 114. please advice what to do
Thanks

admin 10/17/2005

Hi,
you can use this expression to subtract dates
DATEDIFF(due_date,date_given)
For more info please refer to MySQL manual.