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

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2016년 11월 19일
편집: Andrei Bobrov 2016년 11월 19일
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
>>

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Dates and Time에 대해 자세히 알아보기

태그

질문:

2016년 11월 18일

편집:

2016년 11월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by