| Modifier and Type | Field and Description |
|---|---|
| private PeriodBuilder | |
| private DateFormatter | |
| private long | |
| private PeriodFormatter | |
| private String | |
| private TimeZone |
| Access | Constructor and Description |
|---|---|
| public | BasicDurationFormatter(PeriodFormatter formatter, PeriodBuilder builder, DateFormatter fallback, long fallbackLimit)
Creates a basic duration formatter with the given formatter, builder, and fallback. |
| protected | BasicDurationFormatter(PeriodFormatter formatter, PeriodBuilder builder, DateFormatter fallback, long fallbackLimit, String localeName, TimeZone timeZone)
|
| Modifier and Type | Method and Description |
|---|---|
| protected Period | |
| protected String | |
| protected String | |
| public String | formatDurationFrom(long
the duration in milliseconds duration, long the date from which to compute the duration referenceDate)Implements com. |
| public String | formatDurationFromNow(long
the duration in milliseconds duration)Implements com. |
| public String | formatDurationFromNowTo(Date
the ending date targetDate)Implements com. |
| public DurationFormatter | withLocale(String
the name of the new locale locName)Implements com. |
| public DurationFormatter | withTimeZone(TimeZone
the time zone in which to compute durations. tz)Implements com. |
| builder | back to summary |
|---|---|
| private PeriodBuilder builder | |
| fallback | back to summary |
|---|---|
| private DateFormatter fallback | |
| fallbackLimit | back to summary |
|---|---|
| private long fallbackLimit | |
| formatter | back to summary |
|---|---|
| private PeriodFormatter formatter | |
| localeName | back to summary |
|---|---|
| private String localeName | |
| timeZone | back to summary |
|---|---|
| private TimeZone timeZone | |
| BasicDurationFormatter | back to summary |
|---|---|
| public BasicDurationFormatter(PeriodFormatter formatter, PeriodBuilder builder, DateFormatter fallback, long fallbackLimit) Creates a basic duration formatter with the given formatter, builder, and fallback. It's up to the caller to ensure that the locales and timezones of these are in sync. | |
| BasicDurationFormatter | back to summary |
|---|---|
| protected BasicDurationFormatter(PeriodFormatter formatter, PeriodBuilder builder, DateFormatter fallback, long fallbackLimit, String localeName, TimeZone timeZone) | |
| doBuild | back to summary |
|---|---|
| protected Period doBuild(long duration, long referenceDate) | |
| doFallback | back to summary |
|---|---|
| protected String doFallback(long duration, long referenceDate) | |
| doFormat | back to summary |
|---|---|
| protected String doFormat(Period period) | |
| formatDurationFrom | back to summary |
|---|---|
| public String formatDurationFrom(long duration, long referenceDate) Implements com. Doc from com. Formats a duration expressed in milliseconds from a reference date. The reference date allows formatters to use actual durations of variable-length periods (like months) if they wish. The duration is expressed as the number of milliseconds in the past (negative values) or future (positive values) with respect to a reference date (expressed as milliseconds in epoch). | |
| formatDurationFromNow | back to summary |
|---|---|
| public String formatDurationFromNow(long duration) Implements com. Doc from com. Formats a duration expressed in milliseconds. This is a convenience method that calls formatDurationFrom using the current system time as the reference date. | |
| formatDurationFromNowTo | back to summary |
|---|---|
| public String formatDurationFromNowTo(Date targetDate) Implements com. Doc from com. Formats the duration between now and a target date.
This is a convenience method that calls
formatDurationFrom(long, long) using now
as the reference date, and the difference between now and
| |
| withLocale | back to summary |
|---|---|
| public DurationFormatter withLocale(String locName) Implements com. Doc from com. Returns a new DurationFormatter that's the same as this one but formats for a new locale.
| |
| withTimeZone | back to summary |
|---|---|
| public DurationFormatter withTimeZone(TimeZone tz) Implements com. Doc from com. Returns a new DurationFormatter that's the same as this one but uses a different time zone.
| |