C# Regular Expression to validate a date?

后端 未结 10 1664
后悔当初
后悔当初 2020-12-30 04:45

I am trying to validate a date entered into a text box. There is an input mask on the textbox which forces input of xx/xx/xxxx. I am trying to use a regular expression valid

10条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-30 05:40

    This isn't really an answer, but couldn't you use DateTime.Parse or DateTime.TryParse to check that the date is correct?

    Either that or use a DateTime control to make sure it's impossible to enter data that isn't a DateTime. There's lots of JavaScript out there on this subject.

提交回复
热议问题