Cody

Problem 45398. Seconds

Solution 2971417

Submitted on 20 Sep 2020 by ChrisR
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
assert(isequal(sec_time(12,'12'),'12:00:12:000 AM'))

ans = '12:00:12:000 AM'

2   Pass
assert(isequal(sec_time(1200),'00:20:00:000'))

ans = '00:20:00:000'

3   Pass
assert(isequal(sec_time(12000,'24'),'03:20:00:000'))

ans = '03:20:00:000'

4   Pass
assert(isequal(sec_time(22000.34,'24'),'06:06:40:340'))

ans = '06:06:40:340'

5   Pass
assert(isequal(sec_time(88000.34),'00:26:40:340'))

ans = '00:26:40:340'

6   Pass
assert(isequal(sec_time(56734,'12'),' 3:45:34:000 PM'))

ans = ' 3:45:34:000 PM'

7   Pass
assert(isequal(sec_time(556734,'12'),'10:38:54:000 AM'))

ans = '10:38:54:000 AM'

8   Pass
assert(isequal(sec_time(.999,'12'),'12:00:00:999 AM'))

ans = '12:00:00:999 AM'

Suggested Problems

More from this Author149

Community Treasure Hunt

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

Start Hunting!