java.lang.Object
java.util.spi.LocaleServiceProvider
java.text.spi.DateFormatProvider
服务提供者的抽象类,提供
DateFormat 类的具体实现。
- 自从:
- 1.6
-
构造方法总结
构造方法 -
方法总结
修饰符和类型方法描述abstract DateFormatgetDateInstance(int style, Locale locale) 返回一个新的DateFormat实例,它使用指定locale的给定格式样式来格式化日期。abstract DateFormatgetDateTimeInstance(int dateStyle, int timeStyle, Locale locale) 返回一个新的DateFormat实例,它使用指定locale的给定格式样式来格式化日期和时间。abstract DateFormatgetTimeInstance(int style, Locale locale) 返回一个新的DateFormat实例,它使用指定locale的给定格式样式来格式化时间。在类 java.util.spi.LocaleServiceProvider 中声明的方法
getAvailableLocales, isSupportedLocale
-
构造方法详细信息
-
DateFormatProvider
protected DateFormatProvider()唯一的构造方法。 (对于子类构造方法的调用,通常是隐式的。)
-
-
方法详情
-
getTimeInstance
返回一个新的DateFormat实例,它使用指定locale的给定格式样式来格式化时间。- 参数:
style- 给定的格式样式。DateFormat.SHORT、DateFormat.MEDIUM、DateFormat.LONG或DateFormat.FULL之一。locale- 所需的locale。- 返回:
- 时间格式化程序。
- 抛出:
IllegalArgumentException- 如果style无效,或者如果locale不是从getAvailableLocales()返回的locale之一。NullPointerException- 如果locale为空- 参见:
-
getDateInstance
返回一个新的DateFormat实例,它使用指定locale的给定格式样式来格式化日期。- 参数:
style- 给定的格式样式。DateFormat.SHORT、DateFormat.MEDIUM、DateFormat.LONG或DateFormat.FULL之一。locale- 所需的locale。- 返回:
- 日期格式化程序。
- 抛出:
IllegalArgumentException- 如果style无效,或者如果locale不是从getAvailableLocales()返回的locale之一。NullPointerException- 如果locale为空- 参见:
-
getDateTimeInstance
返回一个新的DateFormat实例,它使用指定locale的给定格式样式来格式化日期和时间。- 参数:
dateStyle- 给定的日期格式样式。DateFormat.SHORT、DateFormat.MEDIUM、DateFormat.LONG或DateFormat.FULL之一。timeStyle- 给定的时间格式样式。DateFormat.SHORT、DateFormat.MEDIUM、DateFormat.LONG或DateFormat.FULL之一。locale- 所需的locale。- 返回:
- 日期/时间格式化程序。
- 抛出:
IllegalArgumentException- 如果dateStyle或timeStyle无效,或者如果locale不是从getAvailableLocales()返回的locale之一。NullPointerException- 如果locale为空- 参见:
-