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
Name | Type | Description |
---|---|---|
date | String | Date |
format | String | Identify if date is American or English when parsing due to Month Format |
Outputs
Name | Type | Description |
---|---|---|
success | Boolean | Whether the date parsing was successful |
dayOfWeek | String | The day of the week (e.g., Monday, Tuesday) |
hours | Number | Hours component of the time |
minutes | Number | Minutes component of the time |
seconds | Number | Seconds component of the time |
milliseconds | Number | Milliseconds component of the time |
dayOfMonth | Number | Day of the month (1-31) |
month | String | Full name of the month |
monthNumber | Number | Month number (1-12) |
year | Number | Full year |
unixTimestamp | Number | Unix timestamp in milliseconds |
isoTimestamp | String | ISO 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
Updated 10 days ago