How to use time function?

Thank you. And how can I write the "if" function with this?