Here you can find the source of timestampOf(final ZonedDateTime time)
Parameter | Description |
---|---|
time | Time object to be converted. |
public static Timestamp timestampOf(final ZonedDateTime time)
//package com.java2s; //License from project: Apache License import java.sql.Timestamp; import java.time.Instant; import java.time.ZonedDateTime; public class Main { /**//from w w w. jav a 2 s . c o m * Gets Timestamp for ZonedDateTime. * * @param time Time object to be converted. * @return Timestamp representing time */ public static Timestamp timestampOf(final ZonedDateTime time) { return timestampOf(time.toInstant()); } /** * Gets Timestamp for Instant. * * @param time Time object to be converted. * @return Timestamp representing time */ private static Timestamp timestampOf(final Instant time) { return Timestamp.from(time); } }