Here you can find the source of toDate(@Nullable ZonedDateTime dt)
Parameter | Description |
---|---|
dt | the ZonedDateTime |
@Nullable public static Date toDate(@Nullable ZonedDateTime dt)
//package com.java2s; /*//from w w w .j a v a 2s . c o m * Copyright (c) Interactive Information R & D (I2RD) LLC. * All Rights Reserved. * * This software is confidential and proprietary information of * I2RD LLC ("Confidential Information"). You shall not disclose * such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered * into with I2RD. */ import javax.annotation.Nullable; import java.time.ZonedDateTime; import java.util.Date; public class Main { /** * Convert the given ZonedDateTime to a Date * * @param dt the ZonedDateTime * * @return a Date object that represents the same instant as the ZonedDateTime, at the ZonedDateTime's timezone. */ @Nullable public static Date toDate(@Nullable ZonedDateTime dt) { if (dt == null) return null; return new Date(dt.toInstant().toEpochMilli()); } }