Skip to main content

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. Returns null if parsing fails.

Examples

Example 1: Parse Date Only

Output:

Example 2: Parse DateTime

Example 3: Auto-detect ISO Format

Example 4: Parse with Timezone Context

(Interprets input as being in +05:00 timezone and converts to UTC)

Example 5: Batch Import with Date Parsing

Notes

  • Returns null for invalid or unparseable date strings
  • Supported explicit patterns: 'YYYY-MM-DD', 'YYYY-MM-DDTHH:mm:ss' and 'YYYY-MM-DD HH:mm:ss' (both T and 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

Frequently Asked Questions

It returns a date/time value parsed from a string. You can optionally provide a format pattern to match the input string’s structure.
The function returns null if the input string does not match the expected or specified format.