Need regular expression for validating date in dd-MMM-yyyy format

后端 未结 8 1316
不思量自难忘°
不思量自难忘° 2020-12-31 17:57

I am not expert in writing regular expressions so need your help. I want to validate date in \"dd-MMM-yyyy\" format i.e. 07-Jun-2012. I am using RegularExpressionValidator i

8条回答
  •  时光说笑
    2020-12-31 18:13

    Yet another idea would be to try this (similar to user1441894's idea):

    var x = DateTime.Parse("30-Feb").GetDateTimeFormats();
    

    I learned to use this yesterday (for a different purpose). So try-catch this statement to deal with validity/invalidity of the date :)

提交回复
热议问题