Method Naming Conventions
Description
The method names in Java Date-Time API are made consistent between classes wherever possible.
For example, now
method returns the date or time values of the current moment.
from
methods allow conversion from one class to another.
The following table lists the commonly used prefixes:
of
static factory method
factory method to creates an instance ands validate the input parametersfrom
static factory method converts the input parameters to an instance of the target class.parse
static factory method
parses the input string to create an instance of the target class.format
instance method
formats the temporal object to produce a string.get
instance method
returns a part of the target object.is
instance method
queries the target object.with
instance method
returns a copy of the target object with one element changed.plus
instance method
returns a copy of the object with an amount of time added.minus
instance method
returns a copy of the object with an amount of time subtracted.to
instance method
converts this object to another type.at
instance method
Combines this object with another object.