addDateTimeUnicodePattern

@FormatStringsInDatetimeFormats
inline fun <reified T : Any> GlobalParserOptions.addDateTimeUnicodePattern(pattern: String)

Adds a Unicode date-time pattern to the global parser options of DataFrame.

NOTE: Requires @OptIn(FormatStringsInDatetimeFormats::class) to be used, as usage of addDateTimeFormat is recommended.

DataFrame will attempt to parse Strings using your provided patterns first before falling back to the default (ISO) formats.

For example, to always allow DataFrame to parse "12/24 2023" Strings:

@OptIn(FormatStringsInDatetimeFormats::class)
DataFrame.parser.addDateTimeUnicodePattern<LocalDate>("MM/dd yyyy")

This is a shortcut for:

DataFrame.parser.addDateTimeFormat(LocalDate.Format { byUnicodePattern("MM/dd yyyy") })

NOTE: Patterns provided to global parser options will be ignored for function calls provided with custom DateTimeParserOptions.dateTimeFormats.

For more information: See Parsing Date-time Strings on the documentation website.

See also: DateTimeComponents fallback mechanism

Parameters

pattern

the date-time pattern to add.

formatType

the expected date-time type of the pattern.

See also