I'm trying to write a custom ASP.NET field validator which makes sure the input is a valid date on the format "yyMMdd".
How do I do that?
I'm trying to write a custom ASP.NET field validator which makes sure the input is a valid date on the format "yyMMdd".
How do I do that?
You can try DateTime.ParseExact("091223", "yyMMdd", CultureInfo.InvariantCulture);
EDIT Woops, sorry, didn't see the ASP.NET bit. AFAIK you can make custom validators in ASP.NET? This could be the base of it, and there is also a "TryParseExact" version of the DateTime call, which would allow you to check without exception.