• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2083
  • Last Modified:

Regular expression for time in HH:MM format

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
RaviKavuri
Asked:
RaviKavuri
  • 2
1 Solution
 
Harisha M GCommented:
Hi, expression would be

\d\d:\d\d

or

\d{2}:\d{2}

---
Harish
0
 
quoclanCommented:
regular expression for HH:MM
^([0-1][0-9]|2[0-4]):[0-5][0-9]$
0
 
Harisha M GCommented:
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
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.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now