Description
This activity is used to convert date and time into a specific format. This can either be used with the date returned by other activities or with a manually set date and time.
When this activity is added to the workflow, an Assign value to variable activity block connected to it is automatically added. It stores the output result. Hence, it is convenient to use the output in other activities by choosing the Save the previous step result option.
It is important that the output of this activity is String, not Date.
Export to format is suitable in some business scenarios when we need to fill reports (for example) or do some other tasks where we have to present the date in a specific form. So you can just pick up the output and input it to a certain form, field, text file, etc.
It also simplifies interaction with dates because it does not require writing any additional code using the Date object — which is possible in case you need it, though.
Parameters
The first parameter here is Date. It is required. There are a few ways to set it.
Set a value option either lets you input the date and time manually or use the calendar to choose the date and time. It opens upon clicking the input field.
A convenient way to set the date and time
Much like in a lot of other activities, you can also use Calculate a value to set the date dynamically using JavaScript or Save the previous step result option. As we have already mentioned, this one is especially useful in conjunction with 'Assign value to variable' activity.
10 Jun 2021
. ISO 8601 also supports multiple date formats, such as YYYY-MM-DD that is 2021-06-10
, which also stands for June 10, 2021.
The next parameter is Include Timezone. When it is turned on, you will see the dropdown list containing the UTC timezones. It will be added to the output.
Include Timezone parameter
And the last parameter is Transform to. This is a required one. It defines the format of the output date and time. There are a lot of different formats in this dropdown list.
Transform to parameter and the available options
Results
Now let us take a look at how the output could look like. In this example we chose the YYYY-MM-DD HH:mm:ss format, checked the Include Timezone option and displayed the result using 'User notification' activity.
A complete workflow example. Here we got the current date, saved it, exported it, saved the result and displayed it
The result in an easy to perceive form