Visual Studio .NET - Time validation(hh:mm:ss) in .net

Asked By venkatesh padmanabhan on 01-Apr-07 03:04 AM
Hi...
  I have created a web application using ASP.NET. In that web page, i have a textbox, in which the user has to enter the time(hh:mm:ss) in this format. If the user doesnot enter the time in this format,ie(hh:m:ss), i have to provide an error message saying, time format is not proper. How to achieve this?
please help

Use a Validator and the proper regex - Robbe Morris replied to venkatesh padmanabhan on 01-Apr-07 07:43 AM

You can probably find the regex at http://www.regexlib.com


Sushila Patel replied to venkatesh padmanabhan on 01-Apr-07 08:11 PM

You can use Regex as

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