DateParsingTextX extension

Extension methods for parsing String values into DateTime instances.

Provides multiple parsing strategies:

Used internally by Convert.toDateTime to implement date conversion.

See also: DateOptions for configuring default parsing behavior.

on

Methods

toDateAutoFormat({String? locale, bool useCurrentLocale = false, bool utc = false}) DateTime

Available on String, provided by the DateParsingTextX extension

Attempts to parse the date using a variety of known formats.
toDateFormatted(String format, String? locale, {bool utc = false}) DateTime

Available on String, provided by the DateParsingTextX extension

Parses this string using the supplied format and locale.
toDateTime() DateTime

Available on String, provided by the DateParsingTextX extension

Parses this string into a DateTime using standard ISO 8601 or RFC 3339 formats.
tryToDateAutoFormat({String? locale, bool useCurrentLocale = false, bool utc = false}) DateTime?

Available on String, provided by the DateParsingTextX extension

Attempts toDateAutoFormat while swallowing parsing errors.
tryToDateFormatted(String format, String? locale, {bool utc = false}) DateTime?

Available on String, provided by the DateParsingTextX extension

Attempts to parse this string using format and locale, returning null on failure.
tryToDateTime() DateTime?

Available on String, provided by the DateParsingTextX extension

Attempts to parse this string into a DateTime, returning null on failure.