Please help with military time calculation
I am trying to take 2 times (start time and end time) and have the total time determined. I want it to come out so that if it is an hour and a half total it will look like 1.30 instead of 1.5. I am using Acrobat Pro DC and it always calculates correctly but when I take the file and try it on a work computer which is a different version (not sure which) it comes up with a different answer. Could someone look and see what I am doing wrong please. Sometimes the start time may be 23:00 and end at 00:30 so that is why I added the last part of the code but not what is wrong. Thank You for any help!
var hrsStart = parseInt (this.getField("ST").value.split(":")[0]);
var minStart = parseInt (this.getField("ST").value.split(":")[1]);
var hrsEnd = parseInt (this.getField("ET").value.split(":")[0]);
var minEnd = parseInt (this.getField("ET").value.split(":")[1]);
if (minStart > minEnd) {
var minRez = 60 + minEnd - minStart;
var hrsRez = hrsEnd - 1 - hrsStart;
} else {
var minRez = minEnd - minStart;
var hrsRez = hrsEnd - hrsStart;
}
if (hrsRez < 0){
var hrsRez = hrsRez + 24;
event.value = hrsRez + "." + minRez;
} else {
var hrsRez = hrsRez + 0;
event.value = hrsRez + "." + minRez;}
