Class ZonedTimestampData

  • All Implemented Interfaces:
    Comparable<ZonedTimestampData>

    @PublicEvolving
    public final class ZonedTimestampData
    extends Object
    implements Comparable<ZonedTimestampData>
    An internal data structure representing data of ZonedTimestampType. 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 Detail

      • ISO_FORMATTER

        public static final java.time.format.DateTimeFormatter ISO_FORMATTER
        The 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 Detail

      • getZonedDateTime

        public java.time.ZonedDateTime getZonedDateTime()
        Returns the zoned date-time with time-zone.
      • toInstant

        public java.time.Instant toInstant()
        Converts this ZonedTimestampData object to a Instant.
      • getMillisecond

        public long getMillisecond()
        Returns the number of milliseconds since 1970-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 the LocalDateTime part of this zoned date-time.
      • getTimeZoneId

        public java.time.ZoneId getTimeZoneId()
        Returns the ZoneId part of this zoned date-time.
      • getZoneId

        public String getZoneId()
        Returns the ZoneId string of this zoned date-time.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • fromZonedDateTime

        public static ZonedTimestampData fromZonedDateTime​(java.time.ZonedDateTime zonedDateTime)
        Creates an instance of ZonedTimestampData from an instance of LocalDateTime.
        Parameters:
        zonedDateTime - an instance of ZonedDateTime
      • fromOffsetDateTime

        public static ZonedTimestampData fromOffsetDateTime​(java.time.OffsetDateTime offsetDateTime)
        Creates an instance of ZonedTimestampData from an instance of LocalDateTime.
        Parameters:
        offsetDateTime - an instance of OffsetDateTime
      • of

        public static ZonedTimestampData of​(long millisecond,
                                            int nanoOfMillisecond,
                                            String zoneId)
        Creates an instance of ZonedTimestampData from milliseconds and nanos-of-millisecond with the given zoneId.
        Parameters:
        millisecond - the number of milliseconds
        nanoOfMillisecond - the nanoseconds
        zoneId - 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.