Java Instant Calculate dateOf(final Instant time)

Here you can find the source of dateOf(final Instant time)

Description

Gets Date for Instant.

License

Apache License

Parameter

Parameter Description
time Time object to be converted.

Return

Date representing time

Declaration

public static Date dateOf(final Instant time) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.time.Instant;

import java.time.ZonedDateTime;

import java.util.Date;

public class Main {
    /**//w  ww .  j  a v  a2s  .  co m
     * Gets Date for ZonedDateTime.
     *
     * @param time Time object to be converted.
     * @return Date representing time
     */
    public static Date dateOf(final ZonedDateTime time) {
        return dateOf(time.toInstant());
    }

    /**
     * Gets Date for Instant.
     *
     * @param time Time object to be converted.
     * @return Date representing time
     */
    public static Date dateOf(final Instant time) {
        return Date.from(time);
    }
}

Related

  1. convertInstantToDotNetTicks(Instant instant)
  2. convertToUserTimeZone(Instant timeInSystem, ZoneId userZoneId)
  3. epochToInstant(long epochMilliSecond)
  4. getNquadsFile(final File dir, final Instant time)
  5. getPeriodInstant(LocalDate localDate)
  6. getSnowflakeFromTimestamp(Instant date)