Java Reference
In-Depth Information
the Temporal interface. These methods allow you to move a Temporal back or forward a given
amount of time, defined by a number plus a Temporal-Unit, where the ChronoUnit enumeration
offers a convenient implementation of the TemporalUnit interface.
As you may have anticipated, all the date-time classes representing a point in time like
LocalDate, LocalTime, LocalDateTime, and Instant have many methods in common; table 12.2
summarizes these.
Table 12.2. The common methods of date-time classes representing a
point in time
Method Static Description
from
Yes
Creates an instance of this class from the passed temporal object
now
Yes
Creates a temporal object from the system clock
of
Yes
Creates an instance of this temporal object from its constituent parts
parse
Yes
Creates an instance of this temporal object from a String
atOffset
No
Combines this temporal object with a zone offset
atZone
No
Combines this temporal object with a time zone
format
No
Converts this temporal object into a String using the specified formatter (not
available for Instant)
get
No
Reads part of the state of this temporal object
minus
No
Creates a copy of this temporal object with an amount of time subtracted
plus
No
Creates a copy of this temporal object with an amount of time added
with
No
Creates a copy of this temporal object with part of the state changed
Check what you've learned up to now about manipulating dates with Quiz 12.1 .
Search WWH ::




Custom Search