Calculate time difference in minutes

Santhana Rajhan
Mega Sage

I want a field to display the difference between two times in minutes.

find_real_file.png

Eg: Business Duration = 136

1 ACCEPTED SOLUTION

Hello Santhana


Please try below. g_form doesnot work server side



(function calculatedFieldValue(current) {



var dateString1 = new GlideDateTime(current.begin); //make sure variable name is begin


var dateString2 = new GlideDateTime(current.end); // make sure variable name is end


var diffSeconds = gs.dateDiff(dateString1, dateString2, true);


diffMins = diffSeconds/60;



return Math.round(diffMins);   // return the calculated value



})(current);



Please mark my response as correct and helpful if it helped solved your question.
-Thanks

View solution in original post

20 REPLIES 20

The rule didnt work. The type of the Business Duration field is an integer. Is that a problem?