Calculate Time Difference AppScript Question

I am not sure if there is a function/item in SBM Composer which will output time difference when user inputs Start Time and End Time. Can anyone help out if it's possible/guide me in right direction?

Responses (2)
  • Accepted Answer

    Tuesday, July 07 2015, 10:03 AM - #Permalink
    In a Composer Listing you can add a column that calculates End Time - Start Time.
    In a Transition you can over-ride a field to a value that is a calculation of End Time - Start Time.
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, July 09 2015, 11:01 AM - #Permalink
    I have been using form action that execute JavaScript to do these type of calculations. Here is an example of the JavaScript (the when condition is when either of the fields change values and maybe when the form is loaded):

    var diff;
    var dtStart, dtEnd;
    var nHours, nMinutes, sElapsed;;
    var nTotalMinutes;

    dtStart = GetFieldValue( "START_WORK_DATE_TIME" );
    dtEnd = GetFieldValue( "STOP_WORK_DATE_TIME" );

    diff = parseInt(( dtEnd - dtStart ) / 1000 );

    nTotalMinutes = parseInt( diff / 60 + 0.5 );

    nHours = parseInt( nTotalMinutes / 60 );

    nMinutes = nTotalMinutes - nHours * 60;

    sElapsed = nHours + ":" + nMinutes;

    SetFieldValue( "DURATION", sElapsed );
    The reply is currently minimized Show
Your Reply

Recent Tweets