Add hours and minutes to a datetime field in EDC/CDMS
If you want to add hours and minutes to a date & time field, you can use this template.
For this calculation, you will need a date & time field and a time field which are called 'datetime' and 'add_time' in this calculation.
//Set datetime into right format to add hours and minutes
var splitted_datetime = '{datetime}'.split(';');
var splitted_old_date = splitted_datetime[0].split('-');
var old_date = splitted_old_date[2] + '-' + splitted_old_date[1] + '-' + splitted_old_date[0];
var old_datetime = old_date + ' ' + splitted_datetime[1];
var datetime_dateobj = new Date(old_datetime);
//Split hours and minutes
var hours = '{add_time}'.split(':')[0];
var minutes= '{add_time}'.split(':')[1];
//Add hours and minutes and return in right format
var addHours = moment(datetime_dateobj).add(hours, 'hours');
new_datetime = addHours.add(minutes, 'minutes').format('DD-MM-YYYY HH:mm');
new_datetime;