Package org.apache.flink.cdc.common.data
Class ZonedTimestampData
- java.lang.Object
-
- org.apache.flink.cdc.common.data.ZonedTimestampData
-
- All Implemented Interfaces:
Comparable<ZonedTimestampData>
@PublicEvolving public final class ZonedTimestampData extends Object implements Comparable<ZonedTimestampData>
An internal data structure representing data ofZonedTimestampType. It aims to converting various Java time representations into the date-time in a particular time zone.The ISO date-time format is used by default, it includes the date, time (including fractional parts), and offset from UTC, such as '2011-12-03T10:15:30+01:00'.
-
-
Field Summary
Fields Modifier and Type Field Description static java.time.format.DateTimeFormatterISO_FORMATTERThe ISO date-time format includes the date, time (including fractional parts), and offset from UTC, such as '2011-12-03T10:15:30.030431+01:00'.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(ZonedTimestampData that)booleanequals(Object obj)static ZonedTimestampDatafromOffsetDateTime(java.time.OffsetDateTime offsetDateTime)Creates an instance ofZonedTimestampDatafrom an instance ofLocalDateTime.static ZonedTimestampDatafromZonedDateTime(java.time.ZonedDateTime zonedDateTime)Creates an instance ofZonedTimestampDatafrom an instance ofLocalDateTime.java.time.LocalDateTimegetLocalDateTimePart()Returns theLocalDateTimepart of this zoned date-time.longgetMillisecond()Returns the number of milliseconds since1970-01-01 00:00:00.intgetNanoOfMillisecond()Returns the number of nanoseconds (the nanoseconds within the milliseconds).java.time.ZoneIdgetTimeZoneId()Returns theZoneIdpart of this zoned date-time.java.time.ZonedDateTimegetZonedDateTime()Returns the zoned date-time with time-zone.StringgetZoneId()Returns theZoneIdstring of this zoned date-time.inthashCode()static booleanisCompact(int precision)Returns whether the date-time part is small enough to be stored in a long of milliseconds.static ZonedTimestampDataof(long millisecond, int nanoOfMillisecond, String zoneId)Creates an instance ofZonedTimestampDatafrom milliseconds and nanos-of-millisecond with the given zoneId.java.time.InstanttoInstant()Converts thisZonedTimestampDataobject to aInstant.StringtoString()TimestamptoTimestamp()Converts thisZonedTimestampDataobject to aTimestamp.
-
-
-
Method Detail
-
getZonedDateTime
public java.time.ZonedDateTime getZonedDateTime()
Returns the zoned date-time with time-zone.
-
toInstant
public java.time.Instant toInstant()
Converts thisZonedTimestampDataobject to aInstant.
-
toTimestamp
public Timestamp toTimestamp()
Converts thisZonedTimestampDataobject to aTimestamp.
-
getMillisecond
public long getMillisecond()
Returns the number of milliseconds since1970-01-01 00:00:00.
-
getNanoOfMillisecond
public int getNanoOfMillisecond()
Returns the number of nanoseconds (the nanoseconds within the milliseconds).The value range is from 0 to 999,999.
-
getLocalDateTimePart
public java.time.LocalDateTime getLocalDateTimePart()
Returns theLocalDateTimepart of this zoned date-time.
-
getTimeZoneId
public java.time.ZoneId getTimeZoneId()
Returns theZoneIdpart of this zoned date-time.
-
getZoneId
public String getZoneId()
Returns theZoneIdstring of this zoned date-time.
-
compareTo
public int compareTo(ZonedTimestampData that)
- Specified by:
compareToin interfaceComparable<ZonedTimestampData>
-
fromZonedDateTime
public static ZonedTimestampData fromZonedDateTime(java.time.ZonedDateTime zonedDateTime)
Creates an instance ofZonedTimestampDatafrom an instance ofLocalDateTime.- Parameters:
zonedDateTime- an instance ofZonedDateTime
-
fromOffsetDateTime
public static ZonedTimestampData fromOffsetDateTime(java.time.OffsetDateTime offsetDateTime)
Creates an instance ofZonedTimestampDatafrom an instance ofLocalDateTime.- Parameters:
offsetDateTime- an instance ofOffsetDateTime
-
of
public static ZonedTimestampData of(long millisecond, int nanoOfMillisecond, String zoneId)
Creates an instance ofZonedTimestampDatafrom milliseconds and nanos-of-millisecond with the given zoneId.- Parameters:
millisecond- the number of millisecondsnanoOfMillisecond- the nanosecondszoneId- the zoneId string
-
isCompact
public static boolean isCompact(int precision)
Returns whether the date-time part is small enough to be stored in a long of milliseconds.
-
-