Top Description Methods
com.ibm.icu.impl.duration

public Interface PeriodBuilder

Known Direct Implementers
com.ibm.icu.impl.duration.PeriodBuilderImpl
Imports
java.util.TimeZone

Constructs a Period given a base time and a duration in milliseconds.

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.

Method Summary

Modifier and TypeMethod and Description
public Period

Returns:

a Period that represents the duration
create
(long
the duration in milliseconds from the current time to the target time. A negative duration indicates a time in the past
duration
)

Create a period of the given duration using the current system time as the reference time.

public Period

Returns:

a Period that represents the duration
createWithReferenceDate
(long
the duration in milliseconds from the referenced time to the target time. A negative duration indicates a time before the reference time
duration
,
long
the reference date from which to compute the period
referenceDate
)

Create a period of the given duration using the provided reference date.

public PeriodBuilder
withLocale(String localeName)

Returns a new PeriodBuilder that uses the provided locale to determine what periods are available for use.

public PeriodBuilder
withTimeZone(TimeZone tz)

Returns a new PeriodBuilder that computes periods starting at dates in the provided time zone.

Method Detail

createback to summary
public Period create(long duration)

Create a period of the given duration using the current system time as the reference time.

Parameters
duration:long

the duration in milliseconds from the current time to the target time. A negative duration indicates a time in the past

Returns:Period

a Period that represents the duration

createWithReferenceDateback to summary
public Period createWithReferenceDate(long duration, long referenceDate)

Create a period of the given duration using the provided reference date.

Parameters
duration:long

the duration in milliseconds from the referenced time to the target time. A negative duration indicates a time before the reference time

referenceDate:long

the reference date from which to compute the period

Returns:Period

a Period that represents the duration

withLocaleback to summary
public PeriodBuilder withLocale(String localeName)

Returns a new PeriodBuilder that uses the provided locale to determine what periods are available for use.

withTimeZoneback to summary
public PeriodBuilder withTimeZone(TimeZone tz)

Returns a new PeriodBuilder that computes periods starting at dates in the provided time zone.