Ask AI
Skip to main content

Format date

Function: Format date

This action allows you to take an existing date and transform it into a specific text format. This is useful when you need to display dates in a user-friendly way, integrate with other systems that require a particular date format, or convert a date into a numerical timestamp.

Input

  • Date: The date you want to format. This is a required input.
  • Date format: (Optional) This is a text pattern that tells the system how to arrange the year, month, day, hour, minute, and second. For example, yyyy-MM-dd HH:mm:ss would format a date like 2023-01-31 12:00:00. If you leave this blank and choose "Free format", the system will use a standard date and time format.
    • y for year (e.g., yyyy for 2023)
    • M for month (e.g., MM for 01, MMM for Jan)
    • d for day (e.g., dd for 31)
    • H for hour (0-23, e.g., HH for 12)
    • m for minute (e.g., mm for 00)
    • s for second (e.g., ss for 00)
  • Format type: (Optional) This determines the overall style of formatting.
    • Free format: Allows you to specify a custom Date format string. This is the default option.
    • Epoch milliseconds: Converts the date into a single number representing the milliseconds that have passed since January 1, 1970, 00:00:00 UTC.

Output

  • Name: The name of the variable where the formatted date will be stored. By default, this will be FORMATTED_DATE. This variable will contain the date as a text string.

Execution Flow

Real-Life Examples

Example 1: Displaying a project deadline in a specific format

Imagine you have a project deadline stored as a date and you want to display it on a dashboard as "Day, Month DD, YYYY".

  • Inputs:
    • Date: 2024-03-15 (March 15, 2024)
    • Date format: EEEE, MMMM dd, yyyy
    • Format type: Free format
    • Name: ProjectDeadlineText
  • Result: The variable ProjectDeadlineText will store the text Friday, March 15, 2024.

Example 2: Converting an event start time to a timestamp for an external system

You need to send an event's start time to an external analytics system that expects the time as an Epoch millisecond timestamp.

  • Inputs:
    • Date: 2023-10-27 14:30:00 (October 27, 2023, 2:30 PM UTC)
    • Date format: (Leave blank)
    • Format type: Epoch milliseconds
    • Name: EventTimestamp
  • Result: The variable EventTimestamp will store a number like 1698417000000.

Example 3: Formatting a user's registration date for a welcome email

When a new user registers, you want to include their registration date in a welcome email in a simple DD/MM/YYYY format.

  • Inputs:
    • Date: 2023-09-01 (September 1, 2023)
    • Date format: dd/MM/yyyy
    • Format type: Free format
    • Name: RegistrationDateFormatted
  • Result: The variable RegistrationDateFormatted will store the text 01/09/2023.