I am looking for a regular expression to validate date format mm/dd/yy (including leap year) as well. Date should be masked in MM/DD/YY format. Kindly help me find a solution. Thanks a lot in advance!
Asked
Active
Viewed 932 times
-1
-
1Regex can do it. But this is clearly not the tool you want to use. – Thomas Ayoub Mar 02 '16 at 14:47
-
1Possible duplicate of [Regular Expression | Leap Years and More](http://stackoverflow.com/questions/8647893/regular-expression-leap-years-and-more) – Thomas Ayoub Mar 02 '16 at 14:48
-
possible duplicate of http://stackoverflow.com/questions/939802/date-validation-with-asp-net-validator – Lorenzo Sciuto Mar 02 '16 at 15:02
-
1By the way, this is impossible if you just use mm/dd/**yy** as a date format since `2000` was a leap year and `2100` will not be one. – Thomas Ayoub Mar 07 '16 at 15:04
1 Answers
0
Use DateTime.TryParse (https://msdn.microsoft.com/en-us/library/system.datetime.tryparse(v=vs.110).aspx). Should do what you want.
-
I am looking for date format mm/dd/yy. I see in other post that they have provided solution for mm/dd/yyyy. I am looking for only mm/dd/yy date format. – user1555456 Mar 03 '16 at 17:21