spring-framework / org.springframework.format.datetime.standard / DateTimeFormatterRegistrar

DateTimeFormatterRegistrar

open class DateTimeFormatterRegistrar : FormatterRegistrar

Configures the JSR-310 java.time formatting system for use with Spring.

Author
Juergen Hoeller

Author
Phillip Webb

Since
4.0

See Also
#setDateStyle#setTimeStyle#setDateTimeStyle#setUseIsoFormatorg.springframework.format.FormatterRegistrar#registerFormattersorg.springframework.format.datetime.DateFormatterRegistrarorg.springframework.format.datetime.joda.DateTimeFormatterFactoryBean

Constructors

<init>

DateTimeFormatterRegistrar()

Functions

registerFormatters

open fun registerFormatters(registry: FormatterRegistry): Unit

setDateFormatter

open fun setDateFormatter(formatter: DateTimeFormatter): Unit

Set the formatter that will be used for objects representing date values.

This formatter will be used for the LocalDate type. When specified, the dateStyle and useIsoFormat properties will be ignored.

setDateStyle

open fun setDateStyle(dateStyle: FormatStyle): Unit

Set the default format style of java.time.LocalDate objects. Default is java.time.format.FormatStyle#SHORT.

setDateTimeFormatter

open fun setDateTimeFormatter(formatter: DateTimeFormatter): Unit

Set the formatter that will be used for objects representing date and time values.

This formatter will be used for LocalDateTime, ZonedDateTime and OffsetDateTime types. When specified, the dateTimeStyle and useIsoFormat properties will be ignored.

setDateTimeStyle

open fun setDateTimeStyle(dateTimeStyle: FormatStyle): Unit

Set the default format style of java.time.LocalDateTime objects. Default is java.time.format.FormatStyle#SHORT.

setTimeFormatter

open fun setTimeFormatter(formatter: DateTimeFormatter): Unit

Set the formatter that will be used for objects representing time values.

This formatter will be used for the LocalTime and OffsetTime types. When specified, the timeStyle and useIsoFormat properties will be ignored.

setTimeStyle

open fun setTimeStyle(timeStyle: FormatStyle): Unit

Set the default format style of java.time.LocalTime objects. Default is java.time.format.FormatStyle#SHORT.

setUseIsoFormat

open fun setUseIsoFormat(useIsoFormat: Boolean): Unit

Set whether standard ISO formatting should be applied to all date/time types. Default is "false" (no).

If set to "true", the "dateStyle", "timeStyle" and "dateTimeStyle" properties are effectively ignored.