| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: the formatted timethe duration in milliseconds duration, long the date from which to compute the duration referenceDate)Formats a duration expressed in milliseconds from a reference date. |
| public String | Returns: the formatted timethe duration in milliseconds duration)Formats a duration expressed in milliseconds. |
| public String | Returns: the formatted timethe ending date targetDate)Formats the duration between now and a target date. |
| public DurationFormatter | Returns: a new formatter for the given localethe name of the new locale localeName)Returns a new DurationFormatter that's the same as this one but formats for a new locale. |
| public DurationFormatter | Returns: a new formatter for the given localethe time zone in which to compute durations. tz)Returns a new DurationFormatter that's the same as this one but uses a different time zone. |
| formatDurationFrom | back to summary |
|---|---|
| public String formatDurationFrom(long duration, long referenceDate) 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) 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) 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 localeName) 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) Returns a new DurationFormatter that's the same as this one but uses a different time zone.
| |