Class OffsetTimestampGenerator

    • Constructor Detail

      • OffsetTimestampGenerator

        public OffsetTimestampGenerator()
      • OffsetTimestampGenerator

        public OffsetTimestampGenerator​(java.lang.String offset)
    • Method Detail

      • getOffset

        public java.lang.String getOffset()
        Returns:
        the offset
      • setOffset

        public void setOffset​(java.lang.String offset)
        Set the offset for the timestamp.

        The offset follows the ISO8601 convention for durations. The format is [+-]P[n]Y[n]M[n]DT[n]H[n]M[n]S. In these representations, the [n] is replaced by the value for each of the date and time elements that follow the [n]. Leading zeros are not required. The capital letters 'P', 'Y', 'M', 'W', 'D', 'T', 'H', 'M', and 'S' are designators for each of the date and time elements and are not replaced.

        • P is the duration designator (historically called "period") placed at the start of the duration representation.
        • Y is the year designator that follows the value for the number of years.
        • M is the month designator that follows the value for the number of months.
        • W is the week designator that follows the value for the number of weeks.
        • D is the day designator that follows the value for the number of days.
        • T is the time designator that precedes the time components of the representation.
        • H is the hour designator that follows the value for the number of hours.
        • M is the minute designator that follows the value for the number of minutes.
        • S is the second designator that follows the value for the number of seconds.

          For example, P3Y6M4DT12H30M5S represents a duration of three years, six months, four days, twelve hours, thirty minutes, and five seconds . Date and time elements including their designator may be omitted if their value is zero, and lower order elements may also be omitted for reduced precision. For example, "P23DT23H" and "P4Y" are both acceptable duration representations.

          To resolve ambiguity, "P1M" is a one-month duration and "PT1M" is a one-minute duration (note the time designator, T, that precedes the time value). The seconds value used may also have a decimal fraction, as in "PT0.5S" to indicate half a second."PT36H" could be used as well as "P1DT12H" for representing the same duration.

          A negative period will become some date in the past; a positive or unspecified period will resolve to some time in the future. For example -P30D will resolve to 30 days ago, whereas P30D will resolve to 30 days in the future.

        Parameters:
        offset - the offset.