Package com.ibm.icu.impl.duration.impl
Class YMDDateFormatter
- java.lang.Object
-
- com.ibm.icu.impl.duration.impl.YMDDateFormatter
-
- All Implemented Interfaces:
DateFormatter
public class YMDDateFormatter extends Object implements DateFormatter
A DateFormatter that formats the requested date fields.
-
-
Constructor Summary
Constructors Constructor Description YMDDateFormatter(String requestedFields)Creates a new formatter that formats the requested fields.YMDDateFormatter(String requestedFields, String localeName, TimeZone timeZone)Creates a new formatter that formats the requested fields using the provided locale and time zone.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringformat(long date)Returns a string representing the formatted date.Stringformat(Date date)Returns a string representing the formatted date.DateFormatterwithLocale(String locName)Returns a version of this formatter customized to the provided locale.DateFormatterwithTimeZone(TimeZone tz)Returns a version of this formatter customized to the provided time zone.
-
-
-
Constructor Detail
-
YMDDateFormatter
public YMDDateFormatter(String requestedFields)
Creates a new formatter that formats the requested fields. The formatter defaults to the current locale and time zone.- Parameters:
requestedFields- the requested fields
-
YMDDateFormatter
public YMDDateFormatter(String requestedFields, String localeName, TimeZone timeZone)
Creates a new formatter that formats the requested fields using the provided locale and time zone.- Parameters:
requestedFields- the requested fieldslocaleName- the locale to usetimeZone- the time zone to use
-
-
Method Detail
-
format
public String format(long date)
Returns a string representing the formatted date.- Specified by:
formatin interfaceDateFormatter- Parameters:
date- the date in milliseconds- Returns:
- the formatted time
-
format
public String format(Date date)
Returns a string representing the formatted date.- Specified by:
formatin interfaceDateFormatter- Parameters:
date- the date- Returns:
- the formatted time
-
withLocale
public DateFormatter withLocale(String locName)
Returns a version of this formatter customized to the provided locale.- Specified by:
withLocalein interfaceDateFormatter- Returns:
- a new formatter for the given locale
-
withTimeZone
public DateFormatter withTimeZone(TimeZone tz)
Returns a version of this formatter customized to the provided time zone.- Specified by:
withTimeZonein interfaceDateFormatter- Parameters:
tz- the new time zone- Returns:
- a new formatter for the given time zone
-
-