I want to take out the difference between the two hours, but it was 9 hours more. What is wrong?
var endTime = this.getField("Text4").valueAsString;
var startTime = this.getField("Text2").valueAsString;
if (endTime=="") event.value = "";
var d = util.scand("mm/dd/yyyy HH:MM", "01/01/1970 " + endTime);
var s = util.scand("mm/dd/yyyy HH:MM", "01/01/1970 " + startTime);
event.value = util.printd("HH:MM", d);
What values does you use?
This is not a good way of calculating a time difference. You should take the result of subtracting the values returned by getTime() on both objects and then convert it yourself into hours, by dividing it by 3600000.
Could you present the program?
I am trying programming for the first time and don't know what to fix...
var diffInHours = (d.getTime()-s.getTime())/3600000;
event.value = diffInHours;
This will result in a decimal values, though (1.5, for example), to convert it to a time-format (1:30) would require some additional code.