Search code examples
mulemulesoftmule-el

How to retrieve datetime minus 4 hours in Mule 3


I'm trying to get the current time minus 4 hours using the dateTime function. With the next expression:

#[server.dateTime.plusHours(-4)format("yyyy-MM-dd'T'HH:mm:ss'Z'")]

Flow:

<sub-flow name="retrieve-time-last-run-os">
        <objectstore:retrieve config-ref="ObjectStore_Connector" key="timeNow" defaultValue-ref="#[server.dateTime.plusHours(-4)format(&quot;yyyy-MM-dd'T'HH:mm:ss'Z'&quot;)]" doc:name="Retrieve Time Now"/>
        <set-variable variableName="time" value="#[payload]" doc:name="Save time"/>
</sub-flow>

locally it works fine. The problem is when I deploy this function seems not to work. Does anyone know how to fix this?

Thank you


Solution

  • In the flow there seem to be a missing dot between plusHours() and format().