regex - How to validate a string is in YYYY-MM-DD form (C#) -
most of ways have seen on have involved validating c# date object not want do. i'm working on, user enter string in format example, 1999-02-23. validate string enter follows format of yyyy-mm-dd. solutions have come seem overly complex.
try
var stringtovalidate = "1999-02-23"; datetime dt; bool ok = datetime.tryparseexact( stringtovalidate, "yyyy-mm-dd", cultureinfo.invariantculture, datetimestyles.none, out dt );
Comments
Post a Comment