/*************************************************************
名称:isdate
功能:判断传入的变量值是否标准日期型值
参数:datevalue,源字符串;
返回:True或False,是否是日期
说明:yyyy-mm-dd或yyyy/mm/dd
*************************************************************/
function isdate(datevalue){
var SourceDateValue=datevalue.match(/^(\d{1,4})(-|\/\.)(\d{1,2})\2(\d{1,2})$/);
if(SourceDateValue==null) return false;
var EndDateValue=new Date(SourceDateValue[1],SourceDateValue[3]-1,SourceDateValue[4]);
return (EndDateValue.getFullYear()==SourceDateValue[1]&&(EndDateValue.getMonth()+1)==SourceDateValue[3]&&EndDateValue.getDate()==SourceDateValue[4]);
}
名称:isdate
功能:判断传入的变量值是否标准日期型值
参数:datevalue,源字符串;
返回:True或False,是否是日期
说明:yyyy-mm-dd或yyyy/mm/dd
*************************************************************/
function isdate(datevalue){
var SourceDateValue=datevalue.match(/^(\d{1,4})(-|\/\.)(\d{1,2})\2(\d{1,2})$/);
if(SourceDateValue==null) return false;
var EndDateValue=new Date(SourceDateValue[1],SourceDateValue[3]-1,SourceDateValue[4]);
return (EndDateValue.getFullYear()==SourceDateValue[1]&&(EndDateValue.getMonth()+1)==SourceDateValue[3]&&EndDateValue.getDate()==SourceDateValue[4]);
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货