- java.lang.Object
-
- java.util.spi.LocaleServiceProvider
-
- java.text.spi.DateFormatProvider
-
public abstract class DateFormatProvider extends LocaleServiceProvider
服务提供者的抽象类,提供DateFormat类的具体实现。- 从以下版本开始:
- 1.6
-
-
构造方法摘要
构造方法 变量 构造器 描述 protectedDateFormatProvider()唯一的构造函数。
-
方法摘要
所有方法 实例方法 抽象方法 变量和类型 方法 描述 abstract DateFormatgetDateInstance(int style, Locale locale)返回一个新的DateFormat实例,该实例使用指定语言环境的给定格式样式格式化日期。abstract DateFormatgetDateTimeInstance(int dateStyle, int timeStyle, Locale locale)返回一个新的DateFormat实例,该实例使用指定语言环境的给定格式样式格式化日期和时间。abstract DateFormatgetTimeInstance(int style, Locale locale)返回一个新的DateFormat实例,该实例使用指定语言环境的给定格式样式格式化时间。-
声明方法的类 java.util.spi.LocaleServiceProvider
getAvailableLocales, isSupportedLocale
-
-
-
-
方法详细信息
-
getTimeInstance
public abstract DateFormat getTimeInstance(int style, Locale locale)
返回一个新的DateFormat实例,该实例使用指定语言环境的给定格式样式格式化时间。- 参数
-
style- 给定的格式样式。 中的任一个DateFormat.SHORT,DateFormat.MEDIUM,DateFormat.LONG,或DateFormat.FULL。 -
locale- 所需的区域设置。 - 结果
- 时间格式器。
- 异常
-
IllegalArgumentException- 如果style无效,或者locale不是从getAvailableLocales()返回的语言环境 之一 。 -
NullPointerException- 如果locale为空 - 另请参见:
-
DateFormat.getTimeInstance(int, java.util.Locale)
-
getDateInstance
public abstract DateFormat getDateInstance(int style, Locale locale)
返回一个新的DateFormat实例,该实例使用指定语言环境的给定格式样式格式化日期。- 参数
-
style- 给定的格式样式。 中的任一个DateFormat.SHORT,DateFormat.MEDIUM,DateFormat.LONG,或DateFormat.FULL。 -
locale- 所需的区域设置。 - 结果
- 日期格式化程序。
- 异常
-
IllegalArgumentException- 如果style无效,或者locale不是从getAvailableLocales()返回的语言环境 之一 。 -
NullPointerException- 如果locale为空 - 另请参见:
-
DateFormat.getDateInstance(int, java.util.Locale)
-
getDateTimeInstance
public abstract DateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale locale)
返回一个新的DateFormat实例,该实例使用指定语言环境的给定格式样式格式化日期和时间。- 参数
-
dateStyle- 给定的日期格式样式。 中的任一个DateFormat.SHORT,DateFormat.MEDIUM,DateFormat.LONG,或DateFormat.FULL。 -
timeStyle- 给定的时间格式化样式。 中的任一个DateFormat.SHORT,DateFormat.MEDIUM,DateFormat.LONG,或DateFormat.FULL。 -
locale- 所需的区域设置。 - 结果
- 日期/时间格式化程序。
- 异常
-
IllegalArgumentException- 如果dateStyle或timeStyle无效,或者locale不是从getAvailableLocales()返回的语言环境 之一 。 -
NullPointerException- 如果locale为空 - 另请参见:
-
DateFormat.getDateTimeInstance(int, int, java.util.Locale)
-
-