Class BasicDurationFormat
java.lang.Object
java.text.Format
org.graalvm.shadowed.com.ibm.icu.text.UFormat
org.graalvm.shadowed.com.ibm.icu.text.DurationFormat
org.graalvm.shadowed.com.ibm.icu.impl.duration.BasicDurationFormat
- All Implemented Interfaces:
Serializable,Cloneable
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.graalvm.shadowed.com.ibm.icu.text.UFormat
UFormat.SpanFieldNested classes/interfaces inherited from class java.text.Format
Format.Field -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionformat(Object object, StringBuffer toAppend, FieldPosition pos) Format an arbitrary object.formatDuration(Object obj) JDK 1.5+ onlyformatDurationFrom(long duration, long referenceDate) Formats a duration expressed in milliseconds from a reference date.formatDurationFromNow(long duration) Formats a duration expressed in milliseconds.formatDurationFromNowTo(Date targetDate) Formats the duration between now and a target date.static BasicDurationFormatgetInstance(ULocale locale) Methods inherited from class org.graalvm.shadowed.com.ibm.icu.text.DurationFormat
parseObjectMethods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
-
Constructor Details
-
BasicDurationFormat
public BasicDurationFormat() -
BasicDurationFormat
-
-
Method Details
-
getInstance
-
format
Description copied from class:DurationFormatFormat an arbitrary object. Defaults to a call to formatDurationFromNow() for either Long or Date objects.- Specified by:
formatin classDurationFormat- Parameters:
object- 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.- Returns:
- the toAppend buffer
-
formatDurationFrom
Description copied from class:DurationFormatFormats 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).
- Specified by:
formatDurationFromin classDurationFormat- Parameters:
duration- the duration in millisecondsreferenceDate- the date from which to compute the duration- Returns:
- the formatted time
-
formatDurationFromNow
Description copied from class:DurationFormatFormats a duration expressed in milliseconds.This is a convenience method that calls formatDurationFrom using the current system time as the reference date.
- Specified by:
formatDurationFromNowin classDurationFormat- Parameters:
duration- the duration in milliseconds- Returns:
- the formatted time
-
formatDurationFromNowTo
Description copied from class:DurationFormatFormats 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
targetDate.getTime()as the duration.- Specified by:
formatDurationFromNowToin classDurationFormat- Parameters:
targetDate- the ending date- Returns:
- the formatted time
-
formatDuration
-