Class DateWithTimeZoneOffset

    • Constructor Detail

      • DateWithTimeZoneOffset

        public DateWithTimeZoneOffset​(Date date)
        Creates a new date in UTC, to be output with Z timezone designation.
        Parameters:
        date - The date. Must not be null.
      • DateWithTimeZoneOffset

        public DateWithTimeZoneOffset​(Date date,
                                      int tzOffsetMinutes)
        Creates a new date with timezone offset.
        Parameters:
        date - The date. Must not be null.
        tzOffsetMinutes - The time zone offset in minutes relative to UTC, zero if none. Must be less than +/- 12 x 60.
      • DateWithTimeZoneOffset

        public DateWithTimeZoneOffset​(Date date,
                                      TimeZone tz)
        Creates a new date with timezone offset.
        Parameters:
        date - The date. Must not be null.
        tz - The time zone to determine the time zone offset.
    • Method Detail

      • getDate

        public Date getDate()
        Returns the date.
        Returns:
        The date.
      • isUTC

        public boolean isUTC()
        Returns true if the date is in UTC.
        Returns:
        true if the date is in UTC, else the time zone offset applies.
      • getTimeZoneOffsetMinutes

        public int getTimeZoneOffsetMinutes()
        Returns the time zone offset in minutes relative to UTC.
        Returns:
        The time zone offset in minutes relative to UTC, zero if none.
      • toISO8601String

        public String toISO8601String()
        Returns an ISO 8601 representation in YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DDThh:mm:ss±hh:mm format

        Example: 2019-11-01T18:19:43+03:00

        Returns:
        The ISO 8601 representation.