How to exclude weekend days from Timed Event's duration?

Hello all,

in a customer workflow we have a “Time Intermediate Catch Event” to wait for a period of time, e.g. 3 days (P3D).

        <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">P3D</bpmn:timeDuration>

Now we got the request, that this period should only include working days from Monday to Friday.
So if the time starts on Friday the weekend should not count and the expiration should happen on Wednesday of the following week, not on Monday.
Any to achieve this through the model using scripting or something like this?

Or is the only way to write a method to calculate the expiration date of the Timed event?

Regards, Frank


Hi @langfr,

there is not Out-Of-The-Box solution. The engine has plugin point to register your own BusinessCalendar. Have a look at the package

The dafault calendars are registered in the ProcessEngineConfigurationImpl:

You could register your own business calender in a process engine plugin.

Hope this helps,



Ingo, thanks for your support. Very interesting option to be used in the future.

For just to skip the weekend days as expiration data of a time I fiddled out this apporach:

  • create an input parameter of date type, set the value with a goovy script
  • use the input parameter’s value as the expiration date.
    <bpmn:intermediateCatchEvent id="TimerIntermediateCatchEvent" name="warten bis zum nächsten Werktag" camunda:asyncBefore="true">
          <camunda:inputParameter name="dueDate">
            <camunda:script scriptFormat="groovy">import org.joda.time.DateTime

// create a Joda DateTime object, add 1 day to create dueDate
def dueDate = new DateTime(new java.util.Date() ).plusDays(1)
// skip to next weekday
while ( dueDate.getDayOfWeek() &gt; 5 ) {
// return the result which will create the local task variable for the timer definition
        <bpmn:timeDate xsi:type="bpmn:tFormalExpression">${dueDate.toString()}</bpmn:timeDate>

Regards, Frank

The bigger problem I have found is there is no good business calendar lib for java :-1:t2:

Hi @langfr, by any chance do you know if we can also configure working hours to our timers. For example. working hours are 9-6 PM. Timer at 5 PM and should fire after 2 hours, so intead of firing at 7 PM it should fire next day at 10 AM.

Please do not spam the forum with your question - you’ve ready asked it in 2 posts and started a topic for it. In future please only post questions once.