regular expression validator for textbox to hold a time

Posted on 2006-05-22
Last Modified: 2011-09-20
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

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.

Question by:sah18
    LVL 25

    Expert Comment

    LVL 9

    Expert Comment

    Hey this is an expression using regular expression validator:


    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..
    LVL 3

    Accepted Solution

    using this regular expression

    with a regular expression validator should give you what you are after.
    LVL 9

    Author Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now