首页 > 代码库 > CRM 日期类型的一些处理JS

CRM 日期类型的一些处理JS

//当前日期var now = new Date();//换算为毫秒数var now_ms =  Date.UTC( now.getFullYear(), now.getMonth(),now.getDate());
//getMonth 从0-11 所以真实月份要+1, getDate 注意与 getDay的区别,getDate为日, getDay 为周
//计算开始日期var _form_date =crmForm.all.new_begindate.DataValue ;//计划开始日期加8 小时var form_date = new Date(_form_date.setHours(_form_date.getHours()+8)); var form_ms =Date.UTC(form_date.getFullYear(), form_date.getMonth(),form_date.getDate()); if(form_ms < now_ms){ //如果计划开始日期小于当前日期禁止保存 crmForm.all.new_begindate.DataValue = http://www.mamicode.com/new Date(); crmForm.all.new_enddate.DataValue = new Date(); alert("计划开始日期不能小于当前日期!");}

 

CRM 日期类型的一些处理JS