Ask AI
Skip to main content

Parse date

Function: Parse date

This function converts a text string that represents a date and/or time into a structured date object that your application can use. You can specify the exact format of the text and how to handle any time information. This is useful when you receive dates as plain text and need to perform date-related operations or display them consistently.

Input

  • Date (STRING, Required): The date you want to convert, provided as a piece of text.
    • Default Value: '2026-01-01 12:00:00'
  • Date format (STRING, Optional): The specific pattern that describes how the date text is structured. This helps the system understand your date string correctly.
    • Tips for Date 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 (24-hour format, e.g., HH for 13)
      • h for hour (12-hour format, e.g., hh for 01)
      • m for minute (e.g., mm for 05)
      • s for second (e.g., ss for 30)
    • Example: yyyy-MM-dd HH:mm:ss would match 2023-01-31 12:00:00.
    • Default Value: 'yyyy-MM-dd HH:mm:ss' (If left blank, the system will try to parse common ISO date formats like 2023-01-31T12:00:00Z.)
  • Time handling (SELECT_ONE, Optional): How the time part of the date should be treated if present or missing.
    • Options:
      • Ignore time (set to 00:00:00): If your date text includes time, it will be ignored, and the resulting date object will have the time set to the very beginning of the day (midnight).
      • Ignore time (set to 23:59:59): If your date text includes time, it will be ignored, and the resulting date object will have the time set to the very end of the day.
      • Keep time: The time information from your date text will be preserved in the resulting date object.
    • Default Value: 'KEEP'

Output

  • Name (DATE): The name of the variable where the parsed date will be stored. This variable will hold the date as a DATE type, ready for further use in your application.
    • Default Value: 'FORMATTED_DATE'

Execution Flow

Real-Life Examples

Example 1: Parsing a standard date and time

You have a date and time string from a system log and want to convert it into a date object, keeping the exact time.

  • Inputs:
    • Date: 2024-07-15 14:30:00
    • Date format: yyyy-MM-dd HH:mm:ss
    • Time handling: Keep time
    • Name: LogEntryDateTime
  • Result: A new variable named LogEntryDateTime is created, holding the date and time July 15, 2024, 2:30 PM.

Example 2: Parsing a date without time, setting to end of day

You receive a list of project deadlines as MM/dd/yyyy and want to ensure all deadlines are considered to be at the very end of the day.

  • Inputs:
    • Date: 08/20/2024
    • Date format: MM/dd/yyyy
    • Time handling: Ignore time \(set to 23:59:59\)
    • Name: ProjectDeadline
  • Result: A new variable named ProjectDeadline is created, holding the date August 20, 2024, 11:59:59 PM.

Example 3: Parsing an ISO-formatted date without specifying a custom format

You have a date string in a common ISO format and want to convert it without needing to specify the format pattern.

  • Inputs:
    • Date: 2025-03-10T09:15:00Z
    • Date format: (Leave blank)
    • Time handling: Keep time
    • Name: EventStartTime
  • Result: A new variable named EventStartTime is created, holding the date and time March 10, 2025, 9:15 AM.