public class DateTimeContext
extends java.lang.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 |
---|---|
java.time.chrono.Chronology |
getChronology()
Return the user's chronology (calendar system), if any.
|
java.time.format.DateTimeFormatter |
getFormatter(java.time.format.DateTimeFormatter formatter)
Get the DateTimeFormatter with the this context's settings
applied to the base
formatter . |
java.time.ZoneId |
getTimeZone()
Return the user's time zone, if any.
|
void |
setChronology(java.time.chrono.Chronology chronology)
Set the user's chronology (calendar system).
|
void |
setTimeZone(java.time.ZoneId timeZone)
Set the user's time zone.
|
public void setChronology(@Nullable java.time.chrono.Chronology chronology)
@Nullable public java.time.chrono.Chronology getChronology()
public void setTimeZone(@Nullable java.time.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.
@Nullable public java.time.ZoneId getTimeZone()
public java.time.format.DateTimeFormatter getFormatter(java.time.format.DateTimeFormatter formatter)
formatter
.formatter
- the base formatter that establishes default
formatting rules, generally context-independent