Hi Antony. Good question. I should have included it in the video and tutorial file. You need to covert the input values to strings. Use the following code in the result field (Calculate tab): var start = this.getField("timeIn").valueAsString; var finish = this.getField("timeOut").valueAsString; if (start=="" || finish=="") event.value = ""; else { var oStart = start.split(":") ; var oFinish = finish.split(":") ; var hourDiff = oFinish[0] - oStart[0]; var minDiff = Math.floor(((oFinish[1] - oStart[1]) / 60)*100); if (minDiff
@@tedpadova7633 Hi Ted, thanks for this. The output im getting is in Decimal rather than minutes. Im struggling to get a time output i.e. 09:00-10:54 = 01:54 and im getting 1.9 as the result. Can you help?
Hi antony. So sorry. I've worked on this for quite some time. I haven't gotten the code right yet. I'll try to work on it, but not sure if I can get it right.
Download the tutorial file from:
www.tedpadova.com/acro/timeCalcs.pdf
Thank you very much :)
Helpful video, how do I calculate time when it goes beyond midnight?
Hi Antony. Good question. I should have included it in the video and tutorial file. You need to covert the input values to strings. Use the following code in the result field (Calculate tab):
var start = this.getField("timeIn").valueAsString;
var finish = this.getField("timeOut").valueAsString;
if (start=="" || finish=="") event.value = "";
else {
var oStart = start.split(":") ;
var oFinish = finish.split(":") ;
var hourDiff = oFinish[0] - oStart[0];
var minDiff = Math.floor(((oFinish[1] - oStart[1]) / 60)*100);
if (minDiff
@@tedpadova7633 Hi Ted, thanks for this. The output im getting is in Decimal rather than minutes. Im struggling to get a time output i.e. 09:00-10:54 = 01:54 and im getting 1.9 as the result. Can you help?
Hi antony. So sorry. I've worked on this for quite some time. I haven't gotten the code right yet. I'll try to work on it, but not sure if I can get it right.
@@tedpadova7633 thanks for your efforts. If I work it out I’ll post here!
@@antonyroome5222 OK. I'll try to spend some time working on it and if I work it out, I'll get back to you.