public class DateTimeFormatterFactory extends Object
DateTimeFormatter. Formatters will be
created using the defined pattern, ISO,
or style (considered in that order).createDateTimeFormatter(),
createDateTimeFormatter(DateTimeFormatter),
setPattern(String),
setIso(org.springframework.format.annotation.DateTimeFormat.ISO),
setStyle(String),
DateTimeFormatterFactoryBean| Constructor and Description |
|---|
DateTimeFormatterFactory()
Create a new
DateTimeFormatterFactory instance. |
DateTimeFormatterFactory(String pattern)
Create a new
DateTimeFormatterFactory instance. |
| Modifier and Type | Method and Description |
|---|---|
DateTimeFormatter |
createDateTimeFormatter()
Create a new
DateTimeFormatter using this factory. |
DateTimeFormatter |
createDateTimeFormatter(DateTimeFormatter fallbackFormatter)
Create a new
DateTimeFormatter using this factory. |
void |
setIso(DateTimeFormat.ISO iso)
Set the ISO format used to format date values.
|
void |
setPattern(String pattern)
Set the pattern to use to format date values.
|
void |
setStyle(String style)
Set the two characters to use to format date values.
|
void |
setTimeZone(TimeZone timeZone)
Set the
TimeZone to normalize the date values into, if any. |
public DateTimeFormatterFactory()
DateTimeFormatterFactory instance.public DateTimeFormatterFactory(String pattern)
DateTimeFormatterFactory instance.pattern - the pattern to use to format date valuespublic DateTimeFormatter createDateTimeFormatter()
DateTimeFormatter using this factory. If no specific
style, ISO, or
pattern have been defined the
medium date time format will be used.createDateTimeFormatter(DateTimeFormatter)public DateTimeFormatter createDateTimeFormatter(DateTimeFormatter fallbackFormatter)
DateTimeFormatter using this factory. If no specific
style, ISO, or
pattern have 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).public void setTimeZone(TimeZone timeZone)
TimeZone to normalize the date values into, if any.timeZone - the time zonepublic void setStyle(String style)
This method mimics the styles supported by Joda Time.
style - two characters from the set {"S", "M", "L", "F", "-"}public void setIso(DateTimeFormat.ISO iso)
iso - the ISO formatpublic void setPattern(String pattern)
pattern - the format pattern