Get Time Attributes From Parsed Date

Description

The action takes a date string and format preference (American or English) as input and returns a comprehensive breakdown of the date's components. It supports various date formats including:

  • Standard dates (e.g., "25/12/2023", "12/25/2023")
  • ISO format (e.g., "2023-12-25T15:30:00Z")
  • Written dates (e.g., "25 December 2023", "Monday, December 25, 2023")
  • Various separators (/, -, space)

Inputs

NameTypeDescription
dateStringDate
formatStringIdentify if date is American or English when parsing due to Month Format

Outputs

NameTypeDescription
successBooleanWhether the date parsing was successful
dayOfWeekStringThe day of the week (e.g., Monday, Tuesday)
hoursNumberHours component of the time
minutesNumberMinutes component of the time
secondsNumberSeconds component of the time
millisecondsNumberMilliseconds component of the time
dayOfMonthNumberDay of the month (1-31)
monthStringFull name of the month
monthNumberNumberMonth number (1-12)
yearNumberFull year
unixTimestampNumberUnix timestamp in milliseconds
isoTimestampStringISO 8601 formatted timestamp

Example Usage

Input:

{
    "date": "25/12/2023 15:30",
    "format": "English"
}

Output:

{
    "success": true,
    "dayOfWeek": "Monday",
    "hours": 15,
    "minutes": 30,
    "seconds": 0,
    "milliseconds": 0,
    "dayOfMonth": 25,
    "month": "December",
    "monthNumber": 12,
    "year": 2023,
    "unixTimestamp": 1703518200000,
    "isoTimestamp": "2023-12-25T15:30:00.000Z"
}

Error Handling

If the date cannot be parsed, the action will return an error response with a descriptive message. The success field in the response will indicate whether the parsing was successful.

Notes

  • Numbers are returned as numeric types, not strings
  • The action handles various date formats flexibly