标签:date nbsp 正则表达 验证 正则表达式 var code div time
function myFunction(){ //yyyy-mm-dd hh:mm:ss var reDateTime =/^(?:19|20)[0-9][0-9]-(?:(?:0[1-9])|(?:1[0-2]))-(?:(?:[0-2] [1-9])|(?:[1-3][0-1])) (?:(?:[0-2][0-3])|(?:[0-1][0-9])):[0-5][0-9]$/; //yyyy-mm-dd hh:mm var reDateTime =/^(?:19|20)[0-9][0-9]-(?:(?:0[1-9])|(?:1[0-2]))-(?:(?:[0-2] [1-9])|(?:[1-3][0-1])) (?:(?:[0-2][0-3])|(?:[0-1][0-9]))$/; var isDateTime = reDateTime.test(‘2020-05-14 08:30‘); alert(isDateTime); }
标签:date nbsp 正则表达 验证 正则表达式 var code div time
原文地址:https://www.cnblogs.com/FlowerThree/p/12890623.html