Jquery time difference in hours from two fields

前端 未结 4 1459
小蘑菇
小蘑菇 2020-11-28 14:36

I have two fields in my form where users select an input time (start_time, end_time) I would like to, on the change of these fields, recalcuate the value for another field.<

4条回答
  •  鱼传尺愫
    2020-11-28 15:24

    try this :

    var diff = new Date("Aug 08 2012 9:30") - new Date("Aug 08 2012 5:30");
    diff_time = diff/(60*60*1000);
    

提交回复
热议问题