函数名:CheckDateTime
//功能介绍:检查是否为日期时间
functionCheckDateTime(str){
varreg=/^(\d+)-(\d{1,2})-(\d{1,2})(\d{1,2}):(\d{1,2}):(\d{1,2})$/;
varr=str.match(reg);
if(r==null)returnfalse;
r[2]=r[2]-1;
vard=newDate(r[1],r[2],r[3],r[4],r[5],r[6]);
if(d.getFullYear()!=r[1])returnfalse;
if(d.getMonth()!=r[2])returnfalse;
if(d.getDate()!=r[3])returnfalse;
if(d.getHours()!=r[4])returnfalse;
if(d.getMinutes()!=r[5])returnfalse;
if(d.getSeconds()!=r[6])returnfalse;
returntrue;
}
http://www.corange.cn/archives/2008/03/553.html
//功能介绍:检查是否为日期时间
functionCheckDateTime(str){
varreg=/^(\d+)-(\d{1,2})-(\d{1,2})(\d{1,2}):(\d{1,2}):(\d{1,2})$/;
varr=str.match(reg);
if(r==null)returnfalse;
r[2]=r[2]-1;
vard=newDate(r[1],r[2],r[3],r[4],r[5],r[6]);
if(d.getFullYear()!=r[1])returnfalse;
if(d.getMonth()!=r[2])returnfalse;
if(d.getDate()!=r[3])returnfalse;
if(d.getHours()!=r[4])returnfalse;
if(d.getMinutes()!=r[5])returnfalse;
if(d.getSeconds()!=r[6])returnfalse;
returntrue;
}
http://www.corange.cn/archives/2008/03/553.html