Format the cells that has the time. Change all to 24-hr format.

Input the date first, followed by the time. For time, make sure it's separated by colon ( : ). For example, do not input 1700, but 17:00. Then subtract accordingly. The results will be weird, especially the date, just look at the time. Change the am or pm into hours. It's correct.
