亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

js:日期正則表達(dá)式及檢測(cè)

 更新時(shí)間:2007年04月06日 00:00:00   作者:  
這是yyyy-mm-dd hh:mm:ss 的 
/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/ ; 
這是 yyyy-mm-ddde 的
/^(\d{4})\-(\d{2})\-(\d{2})$/ 

function validateCNDate( strValue ) {
var objRegExp = /^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/


if(!objRegExp.test(strValue))
return false; 
else{
var arrayDate = strValue.split(RegExp.$1); 
var intDay = parseInt(arrayDate[2],10);
var intYear = parseInt(arrayDate[0],10);
var intMonth = parseInt(arrayDate[1],10);

if(intMonth > 12 || intMonth < 1) {
return false;
}

var arrayLookup = { '1' : 31,'3' : 31, '4' : 30,'5' : 31,'6' : 30,'7' : 31,
'8' : 31,'9' : 30,'10' : 31,'11' : 30,'12' : 31}

if(arrayLookup[parseInt(arrayDate[1])] != null) {
if(intDay <= arrayLookup[parseInt(arrayDate[1])] && intDay != 0)
return true; 
}

if (intMonth-2 ==0) {
var booLeapYear = (intYear % 4 == 0 && (intYear % 100 != 0 || intYear % 400 == 0));
if( ((booLeapYear && intDay <= 29) || (!booLeapYear && intDay <=28)) && intDay !=0)
return true;
}
}
return false; 
}

相關(guān)文章

最新評(píng)論