I managed to get the first part working using a couple document level scripts that i found. Time2num and TimeDiff this part is working fine on my PC but on IOS it work only up to 12 hours, over that i get strange numbers.
Here is the script that calculates the RegHours form field
event.value = '';
var fDiff = 0;
/*
// compute the difference for first pair of fields
// get the start time
var sStart = this.getField('StartTime1').value;
// get the end time
var sEnd = this.getField('StopTime1').value;
// complete script only if we have data
if(sStart != '' & sEnd != '') {
// convert sStart string to seconds
var fStart = Time2Num('hh:mm', sStart);
// convert sEnd string to seconds
var fEnd = Time2Num('hh:mm', sEnd);
// compute difference in seconds
fDiff += fEnd - fStart;
}
*/
fDiff = TimeDiff('StartTime1', 'StopTime1');
// convert to rounded minutes if not zero
if (fDiff != 0) {
fDiff = Math.round(fDiff / 60);
// report decimal hours
event.value = fDiff / 60;
}
Here is TimeDiff the document level script
function TimeDiff(cStartField, cEndField) {
var sTimeFormat = 'hh:mm';
var fDiff = 0;
// get the start time
var sStart = this.getField(cStartField).value;
// get the end time
var sEnd = this.getField(cEndField).value;
// complete script only if we have data
if(sStart != '' & sEnd != '') {
// convert sStart string to seconds
var fStart = Time2Num(sTimeFormat, sStart);
// convert sEnd string to seconds
var fEnd = Time2Num(sTimeFormat, sEnd);
// compute difference in seconds
fDiff += fEnd - fStart;
}
return fDiff;
}