Cody

Problem 45378. Lost days

Solution 2812585

Submitted on 9 Aug 2020 by Alfonso Nieto-Castanon
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
a=[2019 2 4]; b=[1992 3 6]; c='yyyy-MM-dd'; y=calendarDuration(26,10,29); assert(isequal(date_dis(a,b,c),y))

ans = calendarDuration 26y 10mo 29d

2   Pass
a=[2029 12 14]; b=[1892 13 16]; c='yyyy-MM-dd'; y=calendarDuration(136,10,28); assert(isequal(date_dis(a,b,c),y))

ans = calendarDuration 136y 10mo 28d

3   Pass
a='14/11/2018'; b='14/12/2009'; c='dd/MM/yyyy'; y=calendarDuration(8,11,0); assert(isequal(date_dis(a,b,c),y))

ans = calendarDuration 8y 11mo

4   Pass
a='29-12-2014'; b='02-01-1916'; c='dd-MM-yyyy'; y=calendarDuration(98,11,27); assert(isequal(date_dis(a,b,c),y))

ans = calendarDuration 98y 11mo 27d