Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

regex - Regular expression for date time format "MM/DD/YY HH:mm:ss AM/PM" in asp.net regular expression validator

Can anyone tell me the regular expression format for "MM/DD/YY HH:mm:ss AM/PM" to use it in a regular expression validator, in asp.net 2.0

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I highly recommend that you do not use regex for this. Instead, you should create your own validator (inherit BaseValidator) and use DateTime.TryParseExact to check that the value can be converted to DateTime.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...