Get current time in script task

Hi Camunda users,

I’m trying to access current time when a script task is launched and put it in a string variable for further use (for example “2020-02-13T00:00:00.000Z”). I’ve seen that dateTime() an now() can be used in expressions but how can I get that in an inline script task?

Thanks in advance, cheers,
Ch.

Hi @ChrisB,

what about this one:

    <bpmn:scriptTask id="Task_18w58qu" name="set date to now" scriptFormat="javascript" camunda:resultVariable="myDate">
      <bpmn:script>new java.util.Date();</bpmn:script>
    </bpmn:scriptTask>

Cheers, Ingo

1 Like