How can I skip the weekends in a date calculation?

We have a caculation written on a date field which is based on normal dates. for this we wanted to exclude saturday and sunday and client holidays. Is there any function in SM for this to achieve?

  • Here is an example of an rtecall to the application, which I have used in formatctrl to populate a date field based on a start time, a duration, and an existing caldutyhours record. For example, this one would return 45 hours in the future, based on a 9-hour-per-day 5-day work week.


    $L.rspTime=tod();$L.return=rtecall("callrad", $L.rc, "", {"file", "name", "prompt", "times,1", "times,2"}, {$file, "planned.end", "MON-FRI/0800-1700", $L.rspTime, '1 21:00:00'})



    $L.startTime=tod(); establishes the beginning time, which you feed into the RAD call later.

    $L.return=rtecall("callrad", $L.rc, "", performs the RAD call, specifying which RAD app to execute.

    {"file", "name", "prompt", "times,1", "times,2"}, are the parameter names which the RAD app expects. These can also be viewed by looking at the parameter panel of in the RAD Editor.

    {$file, "planned.end", "MON-FRI/0800-1700", $L.startTime, '1 21:00:00'}) are the parameter values to send into the RAD app. So, we send $file for the current record, "planned.end" as the field where we want the returned value populated, "MON-FRI/0800-1700" as the name of the caldutyhours record, $L.startTime as the beginning time, and '1 21:00:00' as the duration. Note that the duration is in days_hours:minutes:seconds format, so '1 21:00:00' equates to 45 hours.

  • Hi Chandler,

    Could you please explain on the duration period, here you have menioned as 45 hours. I didnot get the purpose of using it in this rad function. Also could you elaborate on the result pls.

    The  results are as:

    Sat Dec 18 -0001 11:00:00 GMT-0700 (Mountain Standard Time)