jsp 两个日期天数差计算
<script> function changeTimelyFlag(){ var date1 = GetXFormFieldValueById('fd_arrival_date'); /*到达日期id*/ var date2 = GetXFormFieldValueById('fd_current_date'); /*当前日期id*/ var dateStartMillons = new Date(date2).getTime(); var dateEndMillons = new Date(date1).getTime(); var difDays = (dateEndMillons - dateStartMillons) / (24 * 60 * 60 * 1000); //计算出两个日期的差值。 if(difDays>=7){ SetXFormFieldValueById('fd_timely_yes_no', "是"); } else SetXFormFieldValueById('fd_timely_yes_no', "否"); } /*到达日期变化事件*/ AttachXFormValueChangeEventById('fd_arrival_date', changeTimelyFlag ); /*到货日期*/ AttachXFormValueChangeEventById('fd_delivery_date', changeTimelyFlag );