Parsing String to DateTime for Timer Intermediate Catch Event

Hey there,

i want to create a timer-event that will be fired based on a processVariable. It always throws errors, no matter what i do. I tried to use joda-time formatter, formatter Builder and so on. I just can’t get it done right.

Here is the xml for the Event:

<bpmn:intermediateCatchEvent id="IntermediateThrowEvent_1pf3zq9" name="Update Timer">
    <bpmn:timeDate xsi:type="bpmn:tFormalExpression">${dateTime().parse("22.01.2019", DateTimeFormat.forPattern("dd.MM.yyyy"))}</bpmn:timeDate>

I would appreciate your help!

Edit: The error i get is the following:

Unknown property used in expression: 
${dateTime().parse("22.01.2019",DateTimeFormat.forPattern("dd.MM.yyyy"))}. Cause: Cannot resolve  identifier 'DateTimeFormat'

Hi @Pascal,

Static methods cannot be called from an expression. I recommend to use an execution listener at the start of the catch event that converts the process variable to the correct format. Then use this variable in the expression.


Hello Thorben,

Thanks for the reply. I tried something similar. In a Service Task calling a delegate expression that is running beforehand, i created a process-variable named timerDate.

String validFromXmlFormat = DateUtil.fromString(JSON(execution.getVariable("data")).prop("validFrom").stringValue()).toXMLFormat();
execution.setVariable("timerDate", validFromXmlFormat);

Before you ask, i also tried to convert the String into a Date:

Date validFromDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(validFromXmlFormat);

But when i tried to use the variable inside the timer definition of the timer event, i receive an error that this variable is not found.

before posting this, i wanted to get the respective error code. So i reverted my changes back to when i used the process variable. Now it is found and i only receive failures inside of my tests. Which is no Problem.

Thanks for the replay again, dunno why it did not work yesterday and now it works. The magic of sleep, i guess :smiley: