Format dates using the Answer Utilities block
Overview
The Format Date action lets your bot convert a date from one format to another. It’s particularly useful for converting computer friendly date strings to a human readable form.
Here are a few Format Date use cases:
-
Converting a date from one standard format to another.
Example: “2021-05-18” to “May 18, 2021”
-
Converting a date timestamp.
Example: “2021-05-18T05:00:00.000+0000” to “May 18, 2021”
-
Converting to a localized format.
Example: “May 18, 2021” to “le 18 mai 2021”
-
Converting a Unix epoch date.
Example: “1621296000” to “2021-05-18”
Configure the Format Date Block
- Click the Select Action drop-down, then select Format Date. This reveals the options for configuring the Format Date action.

-
Complete the following mandatory fields in the Select Variables for Inputs section:
-
Click the Select Optional Inputs drop-down menu to add your choice of optional fields, as required:
-
Click the Select Optional Variables drop-down and select Formatted Date. This adds the Choose a Variable drop-down menu for the formatted date result.
-
Click the Choose a Variable drop-down menu, then select an existing variable or create a new variable to capture the formatted date.
-
Click the Fallback Answer drop-down menu and select an Answer to display if an error occurs during the block’s operation.
-
Click Save.
The Formatted Date variable can be inserted in any bot dialogue or process where this specific format is required.
Formatting Code Examples
The Format Date block uses Python datetime formatting. But don’t worry! The code for each format parameter is simply a combination of two characters: a percentage symbol followed by a single letter. Keep in mind that letter casing is important for datetime formatting.
Convert YYYY-MM-DD to Month Day, Year
Example: “2021-05-18” to “May 18, 2021”

Convert Month Day, Year to ISO 8601 date-timestamp
Example: “05-18-2021” to “2021-05-18T00:00:00”
