@UsesJava8 public class DateTimeContext extends Object
java.time (JSR-310) settings
such as the user's Chronology (calendar system) and time zone.
A null property value indicate the user has not specified a setting.DateTimeContextHolder| Constructor and Description |
|---|
DateTimeContext() |
| Modifier and Type | Method and Description |
|---|---|
Chronology |
getChronology()
Return the user's chronology (calendar system), if any.
|
DateTimeFormatter |
getFormatter(DateTimeFormatter formatter)
Get the DateTimeFormatter with the this context's settings
applied to the base
formatter. |
ZoneId |
getTimeZone()
Return the user's time zone, if any.
|
void |
setChronology(Chronology chronology)
Set the user's chronology (calendar system).
|
void |
setTimeZone(ZoneId timeZone)
Set the user's time zone.
|
public void setChronology(Chronology chronology)
public Chronology getChronology()
public void setTimeZone(ZoneId timeZone)
Alternatively, set a TimeZoneAwareLocaleContext on
LocaleContextHolder. This context class will fall back to
checking the locale context if no setting has been provided here.
public ZoneId getTimeZone()
public DateTimeFormatter getFormatter(DateTimeFormatter formatter)
formatter.formatter - the base formatter that establishes default
formatting rules, generally context-independent