DateTimeParserOptions

sealed class DateTimeParserOptions<T>(val dateTimeFormats: Set<Pair<KType?, T>>?)

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

Constructors

Link copied to clipboard
protected constructor(dateTimeFormats: Set<Pair<KType?, T>>?)

Types

Link copied to clipboard
Link copied to clipboard
open class Kotlin : DateTimeParserOptions<DateTimeFormat<out Any>>

Kotlin(x) variant of DateTimeParserOptions using DateTimeFormat.

Properties

Link copied to clipboard
open val dateTimeFormats: Set<Pair<KType?, T>>?

Functions

Link copied to clipboard
abstract fun copy(): DateTimeParserOptions<T>