public interface PeriodBuilder
PeriodBuilder may be used alone or be set on a DurationFormatter to customize how that formatter constructs a Period for formatting.
None of the operations on PeriodBuilder change the current builder.
| Modifier and Type | Method and Description |
|---|---|
Period |
create(long duration)
Create a period of the given duration using the current system
time as the reference time.
|
Period |
createWithReferenceDate(long duration,
long referenceDate)
Create a period of the given duration using the provided reference date.
|
PeriodBuilder |
withLocale(String localeName)
Returns a new PeriodBuilder that uses the provided locale to
determine what periods are available for use.
|
PeriodBuilder |
withTimeZone(TimeZone tz)
Returns a new PeriodBuilder that computes periods starting at
dates in the provided time zone.
|
Period create(long duration)
duration - the duration in milliseconds from the current time
to the target time. A negative duration indicates a time in the pastPeriod createWithReferenceDate(long duration, long referenceDate)
duration - the duration in milliseconds from the referenced time
to the target time. A negative duration indicates a time before the
reference timereferenceDate - the reference date from which to compute the periodPeriodBuilder withLocale(String localeName)
PeriodBuilder withTimeZone(TimeZone tz)