How to use time in if statements