Here you can find the source of getDate(LocalDateTime time)
Parameter | Description |
---|---|
time | the LocalDateTime. |
public static Date getDate(LocalDateTime time)
//package com.java2s; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneOffset; import java.util.Date; public class Main { /**/*w ww . java 2s .com*/ * Creates a {@link java.util.Date} from the given {@link java.time.LocalDateTime} * based on the UTC time zone. * * @param time the LocalDateTime. * @return a Date. */ public static Date getDate(LocalDateTime time) { Instant instant = time.toInstant(ZoneOffset.UTC); return Date.from(instant); } }