> This page is for version Scripted.
> For other versions, use one of these documentation indexes:
> - Generative (default): https://developers.ada.cx/generative/llms.txt
> - Scripted: https://developers.ada.cx/scripted/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.ada.cx/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.ada.cx/_mcp/server.

# Format dates using the Answer Utilities block

## Overview\[#UUID-fe09c8d0-ea62-0a3f-ac9f-be0d2fd34e6c_id_1500011264081_id_h_01F76NTFK9HG7NMJM31P1A692D]

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\[#UUID-fe09c8d0-ea62-0a3f-ac9f-be0d2fd34e6c_id_1500011264081_id_h_01F76NTV23KZTEGRX76GPV8YWY]

1. Click the Select Action drop-down, then select **Format Date**. This
   reveals the options for configuring the Format Date action.

![](/_fern-files/_img/d8c0c2d19b582807f63b4a80915e449685335444c13ef063a5b4e1a5409a9862.webp)

2. Complete the following mandatory fields in the **Select Variables
   for Inputs** section:

   <table>
     <tbody>
       <tr>
         <td>
           **Date**
         </td>

         <td>
           Add the date variable you wish to format.
         </td>
       </tr>

       <tr>
         <td>
           **Output Format**
         </td>

         <td>
           Define the format of the outputted date by adding one of the
           following to the Output Format field:

           * ISO - Add "iso" to use the ISO-8601 formatting standard.
           * Epoch - Add "epoch" to use the epoch-unix formatting standard in
             seconds.
           * Custom - There are two ways to define custom date formats,
             depending on the locale you're using:
             * If you're using `en` as your locale, use [Python notation](https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior). This notation is only compatible with the `en` locale.
             * If you're using any locale other than `en`, use [non-English notation](https://babel.pocoo.org/en/latest/dates.html#date-fields).
         </td>
       </tr>
     </tbody>
   </table>

3. Click the **Select Optional Inputs** drop-down menu to add your
   choice of optional fields, as required:

   <table>
     <tbody>
       <tr>
         <td>
           **Input Format** (optional)
         </td>

         <td>
           Define the format of the inputted date.
         </td>
       </tr>

       <tr>
         <td>
           **Locale** (optional)
         </td>

         <td>
           Define the date format for a non-English language or locale.

           This field can contain any two-letter ISO 639-1 code, which you can
           find on the [Codes for the Representation of Names of Languages](https://www.loc.gov/standards/iso639-2/php/code_list.php) page on the Library of Congress website.
         </td>
       </tr>
     </tbody>
   </table>

4. 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.

5. Click the **Choose a Variable** drop-down menu, then select an
   existing variable or create a new variable to capture the formatted
   date.

6. Click the **Fallback Answer** drop-down menu and select an Answer to
   display if an error occurs during the block’s operation.

7. 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](https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior).
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"*

![](/_fern-files/_img/f1a01145106aade9e20e3d1a22c8d508d4cc22c886ea51fc03f74ea9f571f414.webp)

### Convert Month Day, Year to ISO 8601 date-timestamp

***Example:*** *"05-18-2021" to "2021-05-18T00:00:00"*

![](/_fern-files/_img/1625b0f24177ebd7077ad94f7b0b8ef1cf956b080a03dd79ef59739fee1ca1fc.webp)

---

Have any questions? Contact your Ada team, or email us at [](<mailto:help@ada.support%20%E2%80%9CHelp Docs inquiry%E2%80%9D>).