Instant is the standard implementation of a fully immutable instant in time.
Instant
is an implementation of {@link ReadableInstant}. As with all instants, it represents an exact point on the time-line, but limited to the precision of milliseconds. An Instant
should be used to represent a point in time irrespective of any other factor, such as chronology or time zone.
Internally, the class holds one piece of data, the instant as milliseconds from the Java epoch of 1970-01-01T00:00:00Z.
For example, an Instant can be used to compare two DateTime
objects irrespective of chronology or time zone.
boolean sameInstant = dt1.toInstant().equals(dt2.toInstant());
Note that the following code will also perform the same check:
boolean sameInstant = dt1.isEqual(dt2);
Instant is thread-safe and immutable.
@author Stephen Colebourne
@since 1.0