Java Reference
In-Depth Information
Table 6-1. New Date/Time API: Common methods
Name Description
at
Combines with another object
format Use provided formatter to produce a formatted string
from
Factory: Convert input parameters to instance of target
get
Retrieve one field from the instance
is
Examine the state of the given object
minus Return a copy with the given amount subtracted
of
Factory: Create new method by parsing inputs
parse
Factory: Parse single input string to produce instance of target
plus
Return a copy with the given amount added
to
Convert this object to another type
with
Return a copy with the given field changed; replaces set methods
The JSR 310 API specifies a dozen or so main classes. Those representing times are either
“continuous” or “human” time. Continuous time is based on Unix time—a deeper truth from
the dawn of (computer) time, and is represented as a single monotonically increasing num-
ber. The “time” value of 0 in Unix represented the first second of January 1, 1970
UTC—about the time Unix was invented. Each unit of increment there represented one
second of time. This has been used as a time base in most operating systems developed since.
However, a 32-bit integer representing the number of seconds since 1970 runs out fairly
soon—in the year 2038 AD. Most Unix systems have, in the aftermath of the Y2K frenzy,
quietly and well in advance headed off a possible Y2038 frenzy by converting the time value
from a 32-bit quantity to a 64-bit quantity. Java also used this time base, but based its time in
milliseconds, because a 64-bit time in milliseconds since 1970 will not overlow until “quite a
few” years into the future (keep this date open in your calendar—August 17, 292,278,994
CE).
Search WWH ::




Custom Search