Ask AI
Skip to main content

Format date

Function: Format date

This function helps you change how a date looks. You can transform a date into a specific text format, like showing only the year and month, or convert it into a numerical representation called "Epoch milliseconds." This is useful for displaying dates in a user-friendly way or for preparing dates for integration with other systems.

Input

  • Date: The date you want to reformat. This is a required input. (Type: DATE)
  • Date format: (Optional) If you choose "Free format" for the "Format type," this is where you define the pattern for your date. For example, yyyy-MM-dd HH:mm:ss would display a date as 2023-01-31 12:00:00. You can use y for year, M for month, d for day, H for hour, m for minute, and s for second. If left blank for "Free format," the date will be formatted using a standard ISO format (e.g., 2023-07-04T10:00:00). (Type: STRING)
  • Format type: (Optional) Choose how you would like to format the date.
    • 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 GMT. (Type: SELECT_ONE)

Output

  • Name: This is the name you give to the variable that will hold the formatted date. For example, if you enter MyDateString, the result will be stored in a variable named MyDateString. By default, this name is FORMATTED_DATE. (Type: STRING)
    • The actual output of this function is the formatted date (as text or a number), which will be assigned to the variable name you provide.

Execution Flow

Real-Life Examples

  • Example 1: Displaying a date in a user-friendly format for a report

    • Inputs:
      • Date: 2023-10-26 14:30:00
      • Date format: dd/MM/yyyy HH:mm
      • Format type: Free format
      • Name: ReportDate
    • Result: The variable ReportDate will contain the text 26/10/2023 14:30. This could be used to display a transaction date on an invoice or a report header.
  • Example 2: Converting a date for system integration with a third-party API

    • Inputs:
      • Date: 2024-01-15 09:00:00
      • Format type: Epoch milliseconds
      • Name: ApiTimestamp
    • Result: The variable ApiTimestamp will contain a number like 1705309200000. This is useful when sending date information to external systems that expect a numerical timestamp.
  • Example 3: Formatting a date with only the month and year for a summary dashboard

    • Inputs:
      • Date: 2025-03-10 11:45:00
      • Date format: MMMM yyyy
      • Format type: Free format
      • Name: DashboardMonthYear
    • Result: The variable DashboardMonthYear will contain the text March 2025. This could be used for report headers or summaries where only the month and year are relevant.
  • Example 4: Using the default "Free format" for a standard date representation

    • Inputs:
      • Date: 2023-07-04 10:00:00
      • Date format: (Left blank)
      • Format type: Free format
      • Name: StandardDateString
    • Result: The variable StandardDateString will contain the text 2023-07-04T10:00:00. This is useful for standard date representations when no custom format is specified, often used for logging or internal system records.