MATLAB: Convert days to years month and days (leap year issue)

conversionconversitondays to yearsleap yearsMATLAB

I have a GUI receiving data from a board with a processor on it. The processor time is return in a days and milliseconds format. The days are from the beginning of time, for example 0000-01-01. I need a way to convert these days to years, month and days while taking into account leap year. Is there a function that can do this or will I need to write a function for it (please post an example). Thanks!

Best Answer

E.g.
the_date = '1900-01-01';
the_days = 10;
result = datetime(the_date) + the_days;
Then to get at the individual values, e.g.
[y,m,d] = ymd(result);
Related Question