Here you can find the source of zonedDateTimeOf(final ZonedDateTime time)
Parameter | Description |
---|---|
time | ZonedDateTime to be copied |
@Deprecated public static ZonedDateTime zonedDateTimeOf(final ZonedDateTime time)
//package com.java2s; //License from project: Apache License import org.joda.time.ReadableInstant; import java.time.Instant; import java.time.ZoneId; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.util.Calendar; import java.util.Date; public class Main { /**/* www . j a v a 2s .c om*/ * Utility for creating a ZonedDateTime object from a ZonedDateTime. * @param time ZonedDateTime to be copied * @return ZonedDateTime representing time * @deprecated Java 8 transition utility method */ @Deprecated public static ZonedDateTime zonedDateTimeOf(final ZonedDateTime time) { return ZonedDateTime.from(time); } /** * Utility for creating a ZonedDateTime object from a millisecond timestamp. * @param time Miliseconds since Epoch UTC * @return ZonedDateTime representing time */ public static ZonedDateTime zonedDateTimeOf(final long time) { return zonedDateTimeOf(time, ZoneOffset.UTC); } /** * Utility for creating a ZonedDateTime object from a millisecond timestamp. * @param time Miliseconds since Epoch * @param zoneId Time zone * @return ZonedDateTime representing time */ public static ZonedDateTime zonedDateTimeOf(final long time, final ZoneId zoneId) { return ZonedDateTime.ofInstant(Instant.ofEpochMilli(time), zoneId); } /** * Gets ZonedDateTime for ReadableInstant. * @param time Time object to be converted. * @return ZonedDateTime representing time * @deprecated Java 8 transition utility method */ @Deprecated public static ZonedDateTime zonedDateTimeOf(final ReadableInstant time) { return zonedDateTimeOf(time.getMillis()); } /** * Gets ZonedDateTime for Date. * @param time Time object to be converted. * @return ZonedDateTime representing time * @deprecated Java 8 transition utility method */ @Deprecated public static ZonedDateTime zonedDateTimeOf(final Date time) { return zonedDateTimeOf(time.getTime()); } /** * Gets ZonedDateTime for Calendar. * @param time Time object to be converted. * @return ZonedDateTime representing time * @deprecated Java 8 transition utility method */ @Deprecated public static ZonedDateTime zonedDateTimeOf(final Calendar time) { return ZonedDateTime.ofInstant(time.toInstant(), time.getTimeZone().toZoneId()); } }