DateTimeParserOptions
By default, DataFrame tries parsing date-time strings using custom formats and patterns defined in the global parser options and using default ISO formats. This is done for both Kotlin- and Java date-time types in order.
However, if a parsing function is provided with ParserOptions and ParserOptions.dateTime is not null, the global GlobalParserOptions.dateTimeLibrary parser option will be overridden.
Concretely, ParserOptions(dateTime = DateTimeParserOptions.Java) is equivalent to having DataFrame.parser.dateTimeLibrary = ParseDateTimeLibrary.JAVA for that particular function call.
In addition, if that DateTimeParserOptions has any custom formats or patterns, the custom- and default global formats will be ignored, allowing you to essentially override them.
For example:
// force parsing using Java types only
df.parse(
ParserOptions(dateTime = DateTimeParserOptions.Java),
)
// force parsing using the specified Kotlin LocalDate format only
val dateFormat = LocalDate.Format {
monthNumber(padding = Padding.SPACE); char('/'); day(); char(' '); year()
}
df.parse(
ParserOptions(
dateTime = DateTimeParserOptions.Kotlin
.withFormat(dateFormat),
),
)For more information: See Parsing Date-time Strings on the documentation website.
See also: DateTimeComponents fallback mechanism
Inheritors
Types
Java time variant of DateTimeParserOptions using DateTimeFormatter.
Kotlin(x) variant of DateTimeParserOptions using DateTimeFormat.