Class IsoDateInterval

java.lang.Object
org.gbif.api.util.IsoDateInterval

public class IsoDateInterval extends Object

Represents an ISO 8601:2019 date, date-time or date/date-time interval.

Valid serializations include 2023, 2023-08, 2023-08-29, 2023/2024, 2023-08/2023-09 and so on.

  • Constructor Details

  • Method Details

    • getFrom

      @Nullable public Temporal getFrom()
    • setFrom

      public void setFrom(Temporal from)
    • setFrom

      public void setFrom(String textFrom)
    • getTo

      @Nullable public Temporal getTo()
    • setTo

      public void setTo(Temporal to)
    • setTo

      public void setTo(String textTo)
    • toString

      public String toString()
      Returns the date-time interval formatted as a single value where the from and to values are the same (e.g. "2023"), or as unabbreviated date-times at the defined accuracy otherwise ("2023-08-29/2023-08-30" rather than "2023-08-29/30").
      Overrides:
      toString in class Object
    • toString

      public String toString(boolean ignoreNonUTCOffset)
      Returns the date-time interval formatted as a single value where the from and to values are the same (e.g. "2023"), or as unabbreviated date-times at the defined accuracy otherwise ("2023-08-29/2023-08-30" rather than "2023-08-29/30"). Optionally ignore a non-UTC offset.
    • fromString

      public static IsoDateInterval fromString(String text) throws ParseException
      Parses a well-formatted IsoDateInterval from the text representation.
      Throws:
      ParseException
    • fromString

      public static IsoDateInterval fromString(String textFrom, String textTo) throws ParseException
      Parses a well-formatted IsoDateInterval from the text representation.
      Throws:
      ParseException