1
Hello, I have a javascript code that helps me calculate the duration between one hour and another, I need to know how to make these values more dynamic, I want to put the input time in an input, the output time in another input and the result (Qtd of hours) in a 3rd input. Someone can help me?
Follow the code I have
<script type="text/javascript">
var start = '21:00';
var end = '22:20';
s = start.split(':');
e = end.split(':');
min = e[1]-s[1];
hour_carry = 0;
if(min < 0){
min += 60;
hour_carry += 1;
}
hour = e[0]-s[0]-hour_carry;
diff = hour + ":" + min;
alert(diff);
</script>