If you can use an input of regular time (12 hr instead of 24 hr), the attached will do what you want, using this formula :
Code:
=IF(A2="","",MOD((TIMEVALUE(TRIM(SUBSTITUTE(SUBSTITUTE($B2,"pm"," pm"),"am"," am"))))-(TIMEVALUE(TRIM(SUBSTITUTE(SUBSTITUTE($A2,"pm"," pm"),"am"," am")))),1))