RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^([0-1][0-9]|[2][0-3]):([0-5][0-9])$
Description
Matches a string if it is a valid time in the format of HH:MM
Matches
02:04 | 16:56 | 23:59
Non-Matches
02:00 PM | PM2:00 | 24:00
Author Rating: The rating for this expression. Koen Hoorelbeke
Source Thanks to Justin Rogers (via msnews.microsoft.com)
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: de wae
Name: knuckels
Date: 4/18/2018 7:55:39 AM
Comment:
hello, do u no de wae?


Title: de wae
Name: knuckels
Date: 4/18/2018 7:55:11 AM
Comment:
hello, do u no de wae?


Title: I dont get it
Name: BlacChyna
Date: 4/18/2018 7:43:32 AM
Comment:
Ich cheggs nöd sry


Title: I dont get it
Name: BlacChyna
Date: 4/18/2018 7:43:19 AM
Comment:
Ich cheggs nöd sry


Title: I dont get it
Name: BlacChyna
Date: 4/18/2018 7:42:55 AM
Comment:
Ich cheggs nöd sry


Title: Accept entry without leading zero
Name: Streen P
Date: 4/6/2009 7:56:14 AM
Comment:
Use this slightly altered version to accept ex: 9.30 along with 09.30 ^([0-1]?[0-9]|[2]?[0-3]):([0-5][0-9])$ or this to go without leading zeros altogether ^([1]?[0-9]|[2]?[0-3]):([0-5][0-9])$


Title: 12 hour format
Name: Harry
Date: 2/5/2008 8:51:25 AM
Comment:
^([0][1-9]|[1][0-2]):([0-5][0-9]) ([^ap][^m])$ For 12 hour format with AM & PM


Title: 12 hour format
Name: Harry
Date: 2/5/2008 8:50:47 AM
Comment:
^([0][1-9]|[1][0-2]):([0-5][0-9]) ([^ap][^m])$ For 12 hour format with AM & PM


Title: HH:MM
Name: P.DURGA RAO
Date: 2/13/2007 4:26:52 AM
Comment:
"^([0-1][0-9]|[2][0-3]).([0-5][0-9])$" Excelent......Works fine for HH:MM


Title: add.
Name: Yunus
Date: 7/4/2006 12:45:09 AM
Comment:
^([0-1][0-9]|2[0-3])\:([0-5][0-9])$


Title: validating time input fields in Coldfusion or Html
Name: Ken
Date: 12/21/2004 1:10:56 PM
Comment:
Below is the code that force me to input hh:mm:ss I want to inpt hh:mm am (or pm) <cfinput name="arrivaltime" type="text" value="#TimeFormat(arrivaltime,'h:mm tt')#" message="The flight arrival time is invalid" validate="time" id="arrivaltime">


Copyright © 2001-2018, RegexAdvice.com | ASP.NET Tutorials