Cody

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

Solution 2149138

Submitted on 3 Mar 2020 by Nikolaos Nikolaou
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

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