?
Solved

Regular expression for time in HH:MM format

Posted on 2006-04-13
3
Medium Priority
?
2,064 Views
Last Modified: 2008-02-01
Hi
 I need a regular expression for military time format i.e 11:30, 14:45 like that. Could any body help me in this regular expression. I am using regular expression validator in asp.net. Thanks
0
Comment
Question by:RaviKavuri
  • 2
3 Comments
 
LVL 37

Expert Comment

by:Harisha M G
ID: 16449470
Hi, expression would be

\d\d:\d\d

or

\d{2}:\d{2}

---
Harish
0
 
LVL 2

Accepted Solution

by:
quoclan earned 500 total points
ID: 16449523
regular expression for HH:MM
^([0-1][0-9]|2[0-4]):[0-5][0-9]$
0
 
LVL 37

Expert Comment

by:Harisha M G
ID: 16449545
Oh.. yes... but there is a small mistake.. there will not be 24:00 ... (it would be 00:00)

Hence,

^([0-1][0-9]|2[0-3]):[0-5][0-9]$
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month13 days, 19 hours left to enroll

809 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