@UsesJava8
public class DateTimeFormatterFactory
extends java.lang.Object
DateTimeFormatter.
Formatters will be created using the defined pattern,
ISO, and xxxStyle methods (considered in that order).
createDateTimeFormatter(),
createDateTimeFormatter(DateTimeFormatter),
setPattern(java.lang.String),
setIso(org.springframework.format.annotation.DateTimeFormat.ISO),
setDateStyle(java.time.format.FormatStyle),
setTimeStyle(java.time.format.FormatStyle),
setDateTimeStyle(java.time.format.FormatStyle),
DateTimeFormatterFactoryBean| Constructor and Description |
|---|
DateTimeFormatterFactory()
Create a new
DateTimeFormatterFactory instance. |
DateTimeFormatterFactory(java.lang.String pattern)
Create a new
DateTimeFormatterFactory instance. |
| Modifier and Type | Method and Description |
|---|---|
java.time.format.DateTimeFormatter |
createDateTimeFormatter()
Create a new
DateTimeFormatter using this factory. |
java.time.format.DateTimeFormatter |
createDateTimeFormatter(java.time.format.DateTimeFormatter fallbackFormatter)
Create a new
DateTimeFormatter using this factory. |
void |
setDateStyle(java.time.format.FormatStyle dateStyle)
Set the style to use for date types.
|
void |
setDateTimeStyle(java.time.format.FormatStyle dateTimeStyle)
Set the style to use for date and time types.
|
void |
setIso(DateTimeFormat.ISO iso)
Set the ISO format used to format date values.
|
void |
setPattern(java.lang.String pattern)
Set the pattern to use to format date values.
|
void |
setStylePattern(java.lang.String style)
Set the two characters to use to format date values, in Joda-Time style.
|
void |
setTimeStyle(java.time.format.FormatStyle timeStyle)
Set the style to use for time types.
|
void |
setTimeZone(java.util.TimeZone timeZone)
Set the
TimeZone to normalize the date values into, if any. |
public DateTimeFormatterFactory()
DateTimeFormatterFactory instance.public DateTimeFormatterFactory(java.lang.String pattern)
DateTimeFormatterFactory instance.pattern - the pattern to use to format date valuespublic void setPattern(java.lang.String pattern)
pattern - the format patternpublic void setIso(DateTimeFormat.ISO iso)
iso - the ISO formatpublic void setDateStyle(java.time.format.FormatStyle dateStyle)
public void setTimeStyle(java.time.format.FormatStyle timeStyle)
public void setDateTimeStyle(java.time.format.FormatStyle dateTimeStyle)
public void setStylePattern(java.lang.String style)
The first character is used for the date style; the second is for the time style. Supported characters are:
This method mimics the styles supported by Joda-Time. Note that
JSR-310 natively favors FormatStyle as used for
setDateStyle(java.time.format.FormatStyle), setTimeStyle(java.time.format.FormatStyle) and setDateTimeStyle(java.time.format.FormatStyle).
style - two characters from the set {"S", "M", "L", "F", "-"}public void setTimeZone(java.util.TimeZone timeZone)
TimeZone to normalize the date values into, if any.timeZone - the time zonepublic java.time.format.DateTimeFormatter createDateTimeFormatter()
DateTimeFormatter using this factory.
If no specific pattern or style has been defined,
medium date time format will be used.
createDateTimeFormatter(DateTimeFormatter)public java.time.format.DateTimeFormatter createDateTimeFormatter(java.time.format.DateTimeFormatter fallbackFormatter)
DateTimeFormatter using this factory.
If no specific pattern or style has been defined,
the supplied fallbackFormatter will be used.
fallbackFormatter - the fall-back formatter to use when no specific
factory properties have been set (can be null).