It's down to how you interpret the numbers entered. Half past six would be entered as two numbers: 6 and 30. You don't have to use 24 hour clock to make sense of 6 30 as 6:30.
I don't understand the question "how can i write the hours and minutes also am,pm in if statment ??" What if statement are you trying to write?