- Locale
Locale :Java 中表示国家或地区的类,JDK 中提供很多常量,也可以通过Locale(language,countryCode) 的方式来创建,在WEB 应用中可以通过request.getLocale() 方法来获取.
/*locale :Java 中表示国家或地区的类,JDK 中提供很多常量
也可以通过locale(language,countryCode) 的方式来创建
在WEB 应用中可以通过request.getLocale()方法来获取、*/
Locale locale = Locale.CHINA;// 2019-3-2 2:03:08
// locale = locale.US;//Mar 2, 2019 2:02:20 AM
Date date = new Date();
System.err.println(date);
// 获取dateFormat 对象
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, locale);
System.out.println(dateFormat.format(date))