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 and Description |
---|
IsoDateInterval()
Create an empty DateRange.
|
IsoDateInterval(Temporal date)
Create a range with bounds of
date . |
IsoDateInterval(Temporal from,
Temporal to)
Create a range with bounds
from and to . |
Modifier and Type | Method and Description |
---|---|
static IsoDateInterval |
fromString(String text)
Parses a well-formatted IsoDateInterval from the text representation.
|
static IsoDateInterval |
fromString(String textFrom,
String textTo)
Parses a well-formatted IsoDateInterval from the text representation.
|
Temporal |
getFrom() |
Temporal |
getTo() |
void |
setFrom(String textFrom) |
void |
setFrom(Temporal from) |
void |
setTo(String textTo) |
void |
setTo(Temporal to) |
String |
toString()
Returns the date-time interval formatted as a single value where the from and to values are the same
(e.g.
|
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.
|
public IsoDateInterval()
public IsoDateInterval(Temporal date)
date
.public IsoDateInterval(Temporal from, Temporal to)
from
and to
.
from and to must have the same type.IllegalArgumentException
- if from
is greater than to
public String toString()
public String toString(boolean ignoreNonUTCOffset)
public static IsoDateInterval fromString(String text) throws ParseException
ParseException
public static IsoDateInterval fromString(String textFrom, String textTo) throws ParseException
ParseException
Copyright © 2024 Global Biodiversity Information Facility (GBIF). All rights reserved.