@Deprecated public abstract class DurationFormat extends UFormat
Use MeasureFormat to format periods like "5 days, 3 hours"; use RelativeDateTimeFormatter to format relative dates like "5 days ago".
MeasureFormat,
RelativeDateTimeFormatter,
Serialized Form| Modifier | Constructor and Description |
|---|---|
protected |
DurationFormat()
Deprecated.
This API is ICU internal only.
|
protected |
DurationFormat(ULocale locale)
Deprecated.
This API is ICU internal only.
|
| Modifier and Type | Method and Description |
|---|---|
abstract java.lang.StringBuffer |
format(java.lang.Object object,
java.lang.StringBuffer toAppend,
java.text.FieldPosition pos)
Deprecated.
ICU 56
|
abstract java.lang.String |
formatDurationFrom(long duration,
long referenceDate)
Deprecated.
ICU 56
|
abstract java.lang.String |
formatDurationFromNow(long duration)
Deprecated.
ICU 56
|
abstract java.lang.String |
formatDurationFromNowTo(java.util.Date targetDate)
Deprecated.
ICU 56
|
static DurationFormat |
getInstance(ULocale locale)
Deprecated.
ICU 56
|
java.lang.Object |
parseObject(java.lang.String source,
java.text.ParsePosition pos)
Deprecated.
ICU 56
|
@Deprecated protected DurationFormat()
@Deprecated protected DurationFormat(ULocale locale)
@Deprecated public static DurationFormat getInstance(ULocale locale)
@Deprecated
public abstract java.lang.StringBuffer format(java.lang.Object object,
java.lang.StringBuffer toAppend,
java.text.FieldPosition pos)
format in class java.text.Formatobject - the object to format. Should be either a Long, Date, or javax.xml.datatype.Duration object.toAppend - the buffer to append topos - the field position, may contain additional error messages.@Deprecated
public java.lang.Object parseObject(java.lang.String source,
java.text.ParsePosition pos)
parseObject in class java.text.Format@Deprecated public abstract java.lang.String formatDurationFromNowTo(java.util.Date targetDate)
This is a convenience method that calls
formatDurationFrom(long, long) using now
as the reference date, and the difference between now and
targetDate.getTime() as the duration.
targetDate - the ending date@Deprecated public abstract java.lang.String formatDurationFromNow(long duration)
This is a convenience method that calls formatDurationFrom using the current system time as the reference date.
duration - the duration in milliseconds@Deprecated
public abstract java.lang.String formatDurationFrom(long duration,
long referenceDate)
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).
duration - the duration in millisecondsreferenceDate - the date from which to compute the durationCopyright © 2016 Unicode, Inc. and others.