Problem 43612. time of day

Solution 1044085

Submitted on 4 Nov 2016 by LY Cao
  • Size: 15
  • This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
x = '24-Oct-2016 20:26:28'; y_correct = 73587999999895.69; assert(isequal(timeOfDay(x, 'nanoseconds'),y_correct)) units = {'microseconds', 'milliseconds',... 'seconds', 'minutes', 'hours', 'days'}; factors = [1e3; 1e3; 1e3; 60; 60; 24]; for i = 1:6 y_correct = y_correct./factors(i); assert(isequal(timeOfDay(x, units{i}),y_correct)) end

ans = 7.3588e+13 ans = 7.3588e+10 ans = 7.3588e+07 ans = 7.3588e+04 ans = 1.2265e+03 ans = 20.4411 ans = 0.8517

Suggested Problems

More from this Author15

Community Treasure Hunt

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

Start Hunting!