time validation

  • 12 years ago

    hi,

    does anyone know how to check if a string is a valid time?  is there any solution that would be culture neutral - i mean i want my time value to be hh:mm all the time.

     

    thanks. 

  • 12 years ago

    I'd recommend using a regular expression to validate a time.

    The MSDN article below shows you how to use regex: 

    http://msdn.microsoft.com/en-us/library/hs600312(VS.71).aspx

    In the following site, you can search for a pattern that does time validation.

    http://regexlib.com/Search.aspx?k=time

     

  • 12 years ago

    thanks, man, great and elegant idea. appreciate it.

     

     

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Weeks of coding can save you hours of planning.”