Java examples for java.time:Instant
Creates an Instant from java.util.Date or it's subclasses.
//package com.java2s; import java.time.*; import java.util.Date; public class Main { /**// w w w. j ava 2 s . c o m * Creates an {@link Instant} from {@code java.util.Date} or it's subclasses. Null-safe. */ public static Instant asInstant(Date date) { if (date == null) return null; else return Instant.ofEpochMilli(date.getTime()); } }