Click here to Skip to main content
15,881,580 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how do i validate time in 0:00:00 AM to 11:59:00 PM ?
Posted
Comments
Maarten Kools 20-Feb-14 6:27am    
What do you mean validate time? Do you want to validate that some kind of string input validates to a time between 00:00:00 AM to 11:59:00 PM?

1 solution

There are a lot of ways, but a Regex is probably the simplest:
^(1[012]|[1-9]):[0-5][0-9](\s)?(?i)(am|pm)$
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900