Start a conversation

Calculate the duration using time fields

To calculate the total duration of the several time variables and output the duration in hours and minutes, use the following calculation template:

var time1 = moment.duration('{time_var1}').asMinutes();
var time2 = moment.duration('{time_var2}').asMinutes();
var time3 = moment.duration('{time_var3}').asMinutes();
var total_min = time1 + time2 + time3;
var minutes = total_min % 60;
var hours = (total_min - minutes)/60;
hours + ':' + minutes;

Adjust the variables time_var1, time_var2 and time_var3 which are between the brackets and add more variables to the var total_min. 

You can check this code in the calculation helper here.

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Castor Support Team

  2. Posted