regular expression validator for textbox to hold a time

Can someone help me with how to set a validator for a textbox control to make sure that a valid time has been entered?  
Time in in 24-hour format (examples):
9:00 or 09:00
13:00
23:59

I'm thinking I need to use the regular expression validator for this, but I'm not certain is that's the right validator to use.

thanks.
LVL 9
sah18Asked:
Who is Participating?
 
rstraderConnect With a Mentor Commented:
using this regular expression
((?:0?[0-9]|1[0-9]|2[0-3]):[0-5][0-9])

with a regular expression validator should give you what you are after.
0
 
nauman_ahmedCommented:
0
 
Raju SrivatsavayeSoftware EngineerCommented:
Hey this is an expression using regular expression validator:

^(20|21|22|23|[0-1]\d)[0-5]\d$

but this works only like this:

07:30 wrong

0730  correct

try it and you will see


also follow this link..its a tutorial to code validators..

http://www.intellectualconceptsinc.com/library/regular%20expressions.pdf
0
 
sah18Author Commented:
rstrader- i just finally got around to trying this today.  it works perfectly!  exactly what i was hoping for!!

do you know of any good tutorials on regular expression syntax?  i'd really like to learn it better!  thanks again.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.