Jquery time difference in hours from two fields

前端 未结 4 1458
小蘑菇
小蘑菇 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:15

    try

    var diff = ( new Date("1970-1-1 " + end_time) - new Date("1970-1-1 " + start_time) ) / 1000 / 60 / 60;  
    

    have a fiddle

提交回复
热议问题