Description
Parses a date/time string into a Date object using an optional pattern. Supports explicit patterns and falls back to standard Date parsing for other formats.Syntax
Parameters
Returns
Type: Date A Date object representing the parsed date/time. Returnsnull if parsing fails.
Examples
Example 1: Parse Date Only
Example 2: Parse DateTime
Example 3: Auto-detect ISO Format
Example 4: Parse with Timezone Context
Example 5: Batch Import with Date Parsing
Notes
- Returns
nullfor invalid or unparseable date strings - Supported explicit patterns:
'YYYY-MM-DD','YYYY-MM-DDTHH:mm:ss'and'YYYY-MM-DD HH:mm:ss'(bothTand space separators are accepted) - Falls back to JavaScript Date constructor for other formats (ISO8601, etc.)
- Timezone parameter interprets the input time as local time in that offset
- All dates are normalized to UTC internally
See Also
- date.format - Format date to string
- date.truncate - Truncate date to specific unit
- date.toTimeZone - Convert date to timezone
Frequently Asked Questions
What does flex.date.parse return?
What does flex.date.parse return?
It returns a date/time value parsed from a string. You can optionally provide a format pattern to match the input string’s structure.
What happens if the string cannot be parsed?
What happens if the string cannot be parsed?
The function returns
null if the input string does not match the expected or specified format.