Click here to Skip to main content
15,890,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have hh:mm in one usercontrol in winform applications.
i want to validate the time.how to validate it plz help me
Posted
Comments
OriginalGriff 6-Aug-12 3:01am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
We don't know what format the "hh:mm" is in your user control, how you can access it, or anything else.
Use the "Improve question" widget to edit your question and provide better information.

1 solution

Try this:
C#
using System.Text.RegularExpressions;

public bool IsValidTime(string thetime)
{
   Regex checktime =
    new Regex(@"^(20|21|22|23|[01]d|d)(([:][0-5]d){1,2})$");

   return checktime.IsMatch(thetime);
} 

Ref.: time validation[^]

Refer:
Solution to validate your time using JavaScript.
Validate time using JavaScript[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900