Through Java 7, the official class for representing a moment in time, using a thin wrapper around the number of milliseconds from epoch (1970-01-01). In Java 8, java.time.Instant and related classes were introduced as a replacement.
In the JDK through Java 7, the java.util.Date
class is very widely used and contrary to what its name suggests, represents an instant rather than a "date" (i.e. a particular day). Date
objects are mutable.
In Java 8, a new package java.time
was introduced, which contains java.time.Instant
to be used to represent an instant. This package should be preferred over using the old java.util.Date
classes when writing new code.