// 判断输入是否是有效的长日期格式 - "YYYY-MM-DD HH:MM:SS" function isdatetime(str){ var result=str.match(/^(\d{4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/); if(result==null) return false; var d= new Date(result[1], result[3]-1, result[4], result[5], result[6], result[7]); return (d.getFullYear()==result[1]&&(d.getMonth()+1)==result[3]&&d.getDate()==result[4]&&d.getHours()==result[5]&&d.getMinutes()==result[6]&&d.getSeconds()==result[7]); }