Class TimeUnitFormat

All Implemented Interfaces:
Serializable, Cloneable

@Deprecated public class TimeUnitFormat extends MeasureFormat
Deprecated.
ICU 53 use MeasureFormat instead.
Format or parse a TimeUnitAmount, using plural rules for the units where available.

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) {
   }
 

Author:
markdavis
See Also: