Convert to 24 hour format properly for edge cases (midnight and noon)