前台技术--javascript比较日期大小

来源:互联网 发布:淘宝怎么改密码手机上 编辑:程序博客网 时间:2024/05/21 22:55
// 判断日期有效性startDate = startDate.replace("-","/");//替换字符,变成标准格式endDate = endDate.replace("-","/");//替换字符,变成标准格式var d1 = new Date(Date.parse(startDate));var d2 = new Date(Date.parse(endDate));if(d1>d2){  errorMsg = errorMsg + "有效起期不能晚于有效止期 \n";}


参考:http://lichengyezi.iteye.com/blog/562786

0 0
原创粉丝点击