addDateTimeFormat

inline fun <reified T : Any> GlobalParserOptions.addDateTimeFormat(format: DateTimeFormat<out T>)

Adds format to the global parser options of DataFrame.

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

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

DataFrame.parser.addDateTimeFormat(
LocalDate.Format {
monthNumber(padding = Padding.SPACE); char('/'); day(); char(' '); year()
},
)

NOTE: Formats 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

format

org.jetbrains.kotlinx.dataframe.api.format the date-time format to add.

formatType

the expected date-time type of the format.

See also