Java Reference
In-Depth Information
more information at
http://docs.oracle.com/javase/8/docs/api/
There are many rules that can be defined for determining how zone offset varies for
a single time zone. The
ZoneRules
class is used to define these rules for a zone. For
instance,
ZoneRules
can be called on to specify or determine if daylight savings time
is a factor. An
Instant
or
LocalDateTime
can also be passed to
ZoneRules
methods such as
getOffset()
and
getTransition()
to return
ZoneOffset
or
ZoneOffsetTransition
. For more information on
ZoneRules
, refer to the
online documentation at
http://docs.oracle.com/javase/8/docs/api/
Another time zone class that is used often is
ZoneOffsetTransition
. This
class models the transition between the spring and autumn offsets as a result of daylight
savings time changes. It is used to determine if there is a gap between transitions, ob-
taining the duration of a transition, and so on. For more information on
ZoneOff-
ZoneRulesProvider
,
ZoneOffsetTransitionRule
, and other classes
are typically not utilized as often as others for working with dates and time zones.
These classes are useful for managing configuration of time zone rules and transitions.
Note
The classes within the
java.time.zone
package are significant, in that
there is a multitude of methods that can be invoked on each class. This recipe provides a
primer for getting started, with only the basics of time zone usage. For more detailed in-
formation, see the online documentation.
4-14. Comparing Two Dates
Problem
You want to determine if one date is greater than another.
Solution