in addition to alansidman's solution, even if it is an hourly change and it's a 'half past' hour, for example, 11:30 PM, 00:30PM, 1:30PM, where there's no zero hours (sharp midnight), then this formula will work

=IF(C4<C3,D3+1,D3)