[Time][SOLVED] How to compare hours ?

You immediately see the edge cases.

Maybe, but that is not the order people typically think in. If you ask someone to look at that code, and figure out what it does, most people will invert the first test, and say that if it is after 10 and before 22, do something. Writing the code they way you think makes it easier to follow, in my opinion. RobvdVeer's code is exactly how I'd write it.