spring-framework / org.springframework.format.datetime / DateFormatterRegistrar

DateFormatterRegistrar

open class DateFormatterRegistrar : FormatterRegistrar

Configures basic date formatting for use with Spring, primarily for org.springframework.format.annotation.DateTimeFormat declarations. Applies to fields of type Date, Calendar and long.

Designed for direct instantiation but also exposes the static #addDateConverters(ConverterRegistry) utility method for ad-hoc use against any ConverterRegistry instance.

Author
Phillip Webb

Since
3.2

See Also
org.springframework.format.datetime.standard.DateTimeFormatterRegistrarorg.springframework.format.datetime.joda.JodaTimeFormatterRegistrarFormatterRegistrar#registerFormatters

Constructors

<init>

DateFormatterRegistrar()

Configures basic date formatting for use with Spring, primarily for org.springframework.format.annotation.DateTimeFormat declarations. Applies to fields of type Date, Calendar and long.

Designed for direct instantiation but also exposes the static #addDateConverters(ConverterRegistry) utility method for ad-hoc use against any ConverterRegistry instance.

Functions

addDateConverters

open static fun addDateConverters(converterRegistry: ConverterRegistry): Unit

Add date converters to the specified registry.

registerFormatters

open fun registerFormatters(registry: FormatterRegistry): Unit

setFormatter

open fun setFormatter(dateFormatter: DateFormatter): Unit

Set a global date formatter to register.

If not specified, no general formatter for non-annotated Date and Calendar fields will be registered.