Edit this page on GitHub

Home > docs > plugins v1 > Datetime Task

Datetime Task

The datetime task provides methods to populate the current date at the time the flow runs.

The task is provided automatically by Concord and does not require any external dependencies.

Usage

The current date as a java.util.Date object:

${datetime.current()} 

The current date/time from a specific zone formatted using the provided pattern:

${datetime.currentWithZone('zone', 'pattern')}
${datetime.currentWithZone('America/Chicago', 'yyyy/MM/dd HH:mm:ss Z')}

Pattern syntax should follow the standard Java date/time patterns.

The current date formatted as a string with a pattern:

${datetime.current('pattern')}
${datetime.current('yyyy/MM/dd HH:mm:ss')}

A java.util.Date instance formatted into a string:

${datetime.format(dateValue, 'pattern')}
${datetime.format(dateValue, 'yyyy/MM/dd HH:mm:ss')}

Parse a string into a java.util.Date instance:

${datetime.parse(dateStr, 'pattern')}
${datetime.parse('2020/02/18 23:59:59', 'yyyy/MM/dd HH:mm:ss')}

If no timezone specified, the parse method defaults to the current timezone of a Concord agent running the process.