CalendarDateFormat.
Note
End dates and durations are implicitly derived when not explicitly specified. This means that you cannot rely on the returned values from the getters to deduce whether a period has an explicit end date or duration.
3.3.9. Period of Time
Value Name: PERIOD
Purpose: This value type is used to identify values that contain a
precise period of time.
Format Definition: This value type is defined by the following
notation:
period = period-explicit / period-start
period-explicit = date-time "/" date-time
; [ISO.8601.2004] complete representation basic format for a
; period of time consisting of a start and end. The start MUST
; be before the end.
period-start = date-time "/" dur-value
; [ISO.8601.2004] complete representation basic format for a
; period of time consisting of a start and positive duration
; of time.
Description: If the property permits, multiple "period" values are
specified by a COMMA-separated list of values. There are two
forms of a period of time. First, a period of time is identified
by its start and its end. This format is based on the
[ISO.8601.2004] complete representation, basic format for "DATE-
TIME" start of the period, followed by a SOLIDUS character
followed by the "DATE-TIME" of the end of the period. The start
of the period MUST be before the end of the period. Second, a
period of time can also be defined by a start and a positive
duration of time. The format is based on the [ISO.8601.2004]
complete representation, basic format for the "DATE-TIME" start of
the period, followed by a SOLIDUS character, followed by the
[ISO.8601.2004] basic format for "DURATION" of the period.
Example: The period starting at 18:00:00 UTC, on January 1, 1997 and
ending at 07:00:00 UTC on January 2, 1997 would be:
19970101T180000Z/19970102T070000Z
The period start at 18:00:00 on January 1, 1997 and lasting 5
hours and 30 minutes would be:
19970101T180000Z/PT5H30M
No additional content value encoding (i.e., BACKSLASH character
encoding, see Section 3.3.11) is defined for this value type.
| Modifier and Type | Field and Description |
|---|---|
| private Component | |
| private static final TemporalComparator | |
| private final transient CalendarDateFormat | |
| private final TemporalAmountAdapter | |
| private final T | |
| private final T |
| Access | Constructor and Description |
|---|---|
| public | Period(final T
the start date of the period start, final T the end date of the period end)Constructs a new period with the specified start and end date. |
| public | Period(final T
the start date of the period start, final T the end date of the period end, CalendarDateFormat the format used to generate string representations dateFormat)Constructs a new period with the specified start and end date with a common date format. |
| public | |
| public | Period(final T
the start date of the period start, final TemporalAmount the duration of the period duration)Constructs a new period with the specified start date and duration. |
| public | |
| private | Period(final T
the start date of the period start, final TemporalAmountAdapter the duration of the period duration)Constructs a new period with the specified start date and duration. |
| private | Period(final T
the start date of the period start, final TemporalAmountAdapter the duration of the period duration, CalendarDateFormat dateFormat)Constructs a new period with the specified start date and duration. |
| Modifier and Type | Method and Description |
|---|---|
| public final Period | |
| public final int | Returns: a postive value if this period is greater, negative if the other is greater, or zero if they are equala period to compare with this one period)Implements java. Compares the specified period with this period. |
| private int | |
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. Indicates whether some other object is "equal to" this one. |
| public Component | |
| public final TemporalAmount | Returns: the duration of this period in milliseconds.Returns the duration of this period. |
| public final T | |
| public final T | |
| public int | |
| public final boolean | Returns: true if the specified date occurs within the current perioda date to test for inclusion date, final boolean indicates if the start and end of the period are included in the test inclusive)
Deprecated
use
Period#includes(Temporal) instead.
|
| public final boolean | |
| public boolean | Returns: true if the specified period intersects this one, false otherwise.a possible intersecting period other)Decides whether this period intersects with another one. |
| public final boolean | Returns: true if this period consumes no time, otherwise falseAn empty period is one that consumes no time. |
| public static < the expected temporal type of the resulting period T extends Temporal> Period | |
| private static TemporalAmountAdapter | |
| private static <T extends Temporal> T | |
| private static <T extends Temporal> T | |
| public void | |
| public final PeriodList | |
| private PeriodList | |
| public Interval | |
| public Interval | |
| public String | Returns: a string representation of the periodOverrides java. Formats the period as an iCalendar compatible string. |
| pack-priv String | |
| public String | |
| pack-priv String |
| component | back to summary |
|---|---|
| private Component component | |
| DATE_RANGE_COMPARATOR | back to summary |
|---|---|
| private static final TemporalComparator DATE_RANGE_COMPARATOR | |
| dateFormat | back to summary |
|---|---|
| private final transient CalendarDateFormat dateFormat | |
| duration | back to summary |
|---|---|
| private final TemporalAmountAdapter duration | |
| end | back to summary |
|---|---|
| private final T end | |
| start | back to summary |
|---|---|
| private final T start | |
| Period | back to summary |
|---|---|
| public Period(final T start, final T end) Constructs a new period with the specified start and end date.
| |
| Period | back to summary |
|---|---|
| public Period(final T start, final T end, CalendarDateFormat dateFormat) Constructs a new period with the specified start and end date with a common date format.
| |
| Period | back to summary |
|---|---|
| public Period(final DateTime start, final Dur duration)
Deprecated
Constructs a new period with the specified start date and duration.
| |
| Period | back to summary |
|---|---|
| public Period(final T start, final TemporalAmount duration) Constructs a new period with the specified start date and duration.
| |
| Period | back to summary |
|---|---|
| public Period(final T start, final TemporalAmount duration, CalendarDateFormat dateFormat) | |
| Period | back to summary |
|---|---|
| private Period(final T start, final TemporalAmountAdapter duration) Constructs a new period with the specified start date and duration.
| |
| Period | back to summary |
|---|---|
| private Period(final T start, final TemporalAmountAdapter duration, CalendarDateFormat dateFormat) Constructs a new period with the specified start date and duration.
| |
| add | back to summary |
|---|---|
| public final Period Creates a period that encompasses both this period and another one. If the other period is null, return a copy of this period. Note Resulting periods are specified by explicitly setting a start date and end date (i.e. durations are implied). | |
| compareTo | back to summary |
|---|---|
| public final int compareTo(final Period<T> period) Implements java. Compares the specified period with this period. First, compare the start dates. If they are the same, compare the end dates. | |
| compareTo | back to summary |
|---|---|
| private int compareTo(final Period<T> period, TemporalComparator comparator) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getComponent | back to summary |
|---|---|
| public Component getComponent() | |
| getDuration | back to summary |
|---|---|
| public final TemporalAmount getDuration() Returns the duration of this period. If an explicit duration is not specified, the duration is derived from the end date.
| |
| getEnd | back to summary |
|---|---|
| public final T getEnd() Returns the end date of this period. If an explicit end date is not specified, the end date is derived from the duration.
| |
| getStart | back to summary |
|---|---|
public final T getStart()
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| includes | back to summary |
|---|---|
| public final boolean includes(final Date date, final boolean inclusive)
Deprecated use
| |
| includes | back to summary |
|---|---|
| public final boolean includes(final Temporal date) Determines if the specified date occurs within this period (inclusive of period start and end).
| |
| intersects | back to summary |
|---|---|
| public boolean intersects(Period<?> other) Decides whether this period intersects with another one.
| |
| isEmpty | back to summary |
|---|---|
| public final boolean isEmpty() An empty period is one that consumes no time.
| |
| parse | back to summary |
|---|---|
| public static <T extends Temporal> Period Parse a string representation of a period.
| |
| parseDuration | back to summary |
|---|---|
| private static TemporalAmountAdapter parseDuration(String value) | |
| parseEndDate | back to summary |
|---|---|
| private static <T extends Temporal> T parseEndDate(String value, boolean resolve) throws DateTimeParseException | |
| parseStartDate | back to summary |
|---|---|
| private static <T extends Temporal> T parseStartDate(String value) throws DateTimeParseException | |
| setComponent | back to summary |
|---|---|
| public void setComponent(Component component) | |
| subtract | back to summary |
|---|---|
| public final PeriodList Creates a set of periods resulting from the subtraction of the specified period from this one. If the specified period is completely contained in this period, the resulting list will contain two periods. Otherwise it will contain one. If the specified period does not intersect this period a list containing this period is returned. If this period is completely contained within the specified period an empty period list is returned.
| |
| subtractInterval | back to summary |
|---|---|
| private PeriodList | |
| toInterval | back to summary |
|---|---|
| public Interval toInterval() | |
| toInterval | back to summary |
|---|---|
| public Interval toInterval(ZoneId zoneId) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Formats the period as an iCalendar compatible string. Note Where a period represents floating date/time values the default local timezone is applied prior to formatting. | |
| toString | back to summary |
|---|---|
| pack-priv String toString(CalendarDateFormat dateFormat) | |
| toString | back to summary |
|---|---|
| public String toString(ZoneId zoneId) Formats the period as an iCalendar compatible string in the specified timezone.
| |
| toString | back to summary |
|---|---|
| pack-priv String toString(CalendarDateFormat dateFormat, ZoneId zoneId) | |