MATLAB: Please help!!!! Write a function that returns the number of days between dates

function

Write a function that returns the number of days between dates:

Best Answer

days_between_dates = @(month1,day1,year1,month2,day2,year2)...
abs(datenum(year1,month1,day1) - datenum(year2,month2,day2));
or
days_between_dates = @(month1,day1,year1,month2,day2,year2)...
abs(diff(datenum([year1,month1,day1;year2,month2,day2])));
use:
>> days_between_dates(10,12,2015,9,5,2016)
ans =
329
>>