Regular expression for valid time format (hr:min:sec) entered by user in text box
-
Hi all I have a text box, which will take input from user in hr:min:sec format. I would like to verify: 1. User enters the in correct format, 2. I would like to verify of the values are correct, e.g. for hrs < 24, for mins it should be less than 60 and simillarly for sec should be less than 60. or is there any way, that I can set the text box to take user input as hrs:min:sec format. pls guide me. thanks
-
Hi all I have a text box, which will take input from user in hr:min:sec format. I would like to verify: 1. User enters the in correct format, 2. I would like to verify of the values are correct, e.g. for hrs < 24, for mins it should be less than 60 and simillarly for sec should be less than 60. or is there any way, that I can set the text box to take user input as hrs:min:sec format. pls guide me. thanks
Have you looked at the validation controls that are available?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
-
Have you looked at the validation controls that are available?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
-
Thanks for reply. I have regular expression validator, but wanted to have the regular expression to check user input in HH:MM:SS format. I am using, regular expression ^([0-1][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$
Have you looked at Expresso, here at CP? It is a really great tool for building/testing regular expressions.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
-
Have you looked at Expresso, here at CP? It is a really great tool for building/testing regular expressions.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
Thanks for the information. I have following regular expression to check HH:MM:SS format of the text box.
^([0-1]?[0-9]|2[0-3]):([0-5]?[0-9]):([0-5]?[0-9])$
I would like to give the flexibility to the user to enter the data in MM:SS format too. I was trying to modify the above regular expression to validate for the MM:SS format too. but didnt get the success. can anyone please help me to build the regular expression to allow user to enter data in HH:MM:SS and MM:SS format too. Thanks a lot.