Cody

# Problem 43275. calculate the day of the year from a date string.

Solution 2200679

Submitted on 8 Apr 2020 by Michael Jarboe
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
start = '09-Oct-2016'; for i = 1:10 date = datestr(datenum(start) + i); doy_correct = 283 + i; doy = dayoftheyear(date); assert(isequal(doy, doy_correct)); end start = '04-Oct-1937'; for i = 1:10 date = datestr(datenum(start) + i); doy_correct = 277 + i; doy = dayoftheyear(date); assert(isequal(doy, doy_correct)); end

DATE = datetime 10-Oct-2016 doy = 284 DATE = datetime 11-Oct-2016 doy = 285 DATE = datetime 12-Oct-2016 doy = 286 DATE = datetime 13-Oct-2016 doy = 287 DATE = datetime 14-Oct-2016 doy = 288 DATE = datetime 15-Oct-2016 doy = 289 DATE = datetime 16-Oct-2016 doy = 290 DATE = datetime 17-Oct-2016 doy = 291 DATE = datetime 18-Oct-2016 doy = 292 DATE = datetime 19-Oct-2016 doy = 293 DATE = datetime 05-Oct-1937 doy = 278 DATE = datetime 06-Oct-1937 doy = 279 DATE = datetime 07-Oct-1937 doy = 280 DATE = datetime 08-Oct-1937 doy = 281 DATE = datetime 09-Oct-1937 doy = 282 DATE = datetime 10-Oct-1937 doy = 283 DATE = datetime 11-Oct-1937 doy = 284 DATE = datetime 12-Oct-1937 doy = 285 DATE = datetime 13-Oct-1937 doy = 286 DATE = datetime 14-Oct-1937 doy = 287