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

 Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 19 Nov 2016
Modifié(e) : Andrei Bobrov le 19 Nov 2016
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
>>

Plus de réponses (0)

Catégories

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by