且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用正则表达式验证datetime dd/mm/yyyy hh:mm tt格式

更新时间:2023-02-26 13:35:44

伙计,
使用此代码将起作用

< code> < asp:RegularExpressionValidator ID ="REV_txtDoj" runat ="server" ErrorMessage =以dd/MM/yyyy格式提供日期"
ValidationExpression ="^(((((((0 [1-9]] ||(1 \ d)|(2 [0-8]]))//((0 [1-9])|(1 [0-2 ])))|((31 \/((0 [13578])|(1 [02])))|((29 | 30)\/((0 [1,3-9])|(1 [ 0-2])))))))//((20 [0-9] [0-9])|(19 [0-9] [0-9])))|((29 (19 | 20)((([02468] [048])|([13579] [26])))))
Hi dude,
use this code it will work

<code> <asp:RegularExpressionValidator ID="REV_txtDoj" runat="server" ErrorMessage="Give date in dd/MM/yyyy Format"
ValidationExpression="^(((((0[1-9])|(1\d)|(2[0-8]))\/((0[1-9])|(1[0-2])))|((31\/((0[13578])|(1[02])))|((29|30)\/((0[1,3-9])|(1[0-2])))))\/((20[0-9][0-9])|(19[0-9][0-9])))|((29\/02\/(19|20)(([02468][048])|([13579][26]))))


"
ValidationGroup ="Save" ControlToValidate ="txtDoj" SetFocusOnError ="true" Display ="Dynamic"></asp:RegularExpressionValidator></code>
"
ValidationGroup="Save" ControlToValidate="txtDoj" SetFocusOnError="true" Display="Dynamic"></asp:RegularExpressionValidator></code>


try:
http://***.com/questions/6314305/how-to-validate-the-datetime-of-mm-dd-yyyy-hhmm-format [
try:
http://***.com/questions/6314305/how-to-validate-the-datetime-of-mm-dd-yyyy-hhmm-format[^]