Java Utililty Methods Date to Instant

List of utility methods to do Date to Instant

Description

The list of methods to do Date to Instant are organized into topic(s).

Method

InstantasInstant(Date date)
Creates an Instant from java.util.Date or it's subclasses.
if (date == null)
    return null;
else
    return Instant.ofEpochMilli(date.getTime());
InstanttoInstant(Date date)
to Instant
if (isInfFuture(date)) {
    return INF_FUTURE;
} else if (isInfPast(date)) {
    return INF_PAST;
} else {
    return date.toInstant();
InstanttoInstant(Date date)
Convert to Instance
return date == null ? null : date.toInstant();
InstanttoInstant(Date date)
to Instant
if (date == null) {
    return null;
Instant moment = Instant.ofEpochMilli(date.getTime());
return moment;