MeasureFormat instead.@Deprecated public class TimeUnitFormat extends MeasureFormat
Code Sample:
// create a time unit instance.
// only SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, and YEAR are supported
TimeUnit timeUnit = TimeUnit.SECOND;
// create time unit amount instance - a combination of Number and time unit
TimeUnitAmount source = new TimeUnitAmount(2, timeUnit);
// create time unit format instance
TimeUnitFormat format = new TimeUnitFormat();
// set the locale of time unit format
format.setLocale(new ULocale("en"));
// format a time unit amount
String formatted = format.format(source);
System.out.println(formatted);
try {
// parse a string into time unit amount
TimeUnitAmount result = (TimeUnitAmount) format.parseObject(formatted);
// result should equal to source
} catch (ParseException e) {
}
TimeUnitAmount,
MeasureFormat,
Serialized FormMeasureFormat.FormatWidthUFormat.SpanFieldFormat.Fieldequals, format, formatMeasurePerUnit, formatMeasures, formatMeasures, getCurrencyFormat, getCurrencyFormat, getCurrencyFormat, getInstance, getInstance, getInstance, getInstance, getLocale, getNumberFormat, getUnitDisplayName, getWidth, hashCode, parseObjectclone, format, formatToCharacterIterator, parseObject