How can 11:59 PM' + '24:05' have '12:04 AM' as a result?

There are two errors I get with my Time Calculator app. Both of those have ‘11:59 PM’ as a start and ‘24:05’ as a duration. If i add them up I get 00:04 AM (2 days later) but, in the test it is written that I should get 12:04 AM (2 days later). By my logic 11:59 PM is one minute before midnight and if I add 24:05 it would be four minutes after midnight on the second day. Is my logic wrong or is it a typo in the test unit?

Your code so far

Challenge: Time Calculator

Link to the challenge:

If i add them up I get 00:04 AM (2 days later) but, in the test it is written that I should get 12:04 AM (2 days later)

You seem to be mixing up 12-hour notation and 24-hour notation.

12:04AM would be the same as 00:04 (note the lack of AM postfix here). It sounds like your math is correct, but your output parsing is not. :slightly_smiling_face:

1 Like

By God you are correct.
Thanks!

1 Like

Glad to help! Sometimes it just takes a second set of eyes.

1 Like

Yea, I totally forgot that the 12-hour clock goes from 1 to 12 not 0 to 12.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.