Hours Passed

Published by Mubashir Hassan in

Create a function that takes time1 and time2 and return how many hours have passed between the two times.

Examples

hoursPassed("3:00 AM", "9:00 AM") ➞ "6 hours"

hoursPassed("2:00 PM", "4:00 PM") ➞ "2 hours"

hoursPassed("1:00 AM", "3:00 PM") ➞ "14 hours"

Notes

time1 will always be the starting time and time2 the ending time. Return "no time passed" if time1 is equal to time2.

Watch a quick demo on how Edabit works.