【发布时间】:2017-11-07 20:37:05
【问题描述】:
我正在寻找有关如何在我的 Android 应用程序中为各种语言环境(例如芬兰语、法语等)设置日期和时间格式的文档。我在 Android 的文档中找不到此信息。
【问题讨论】:
标签: android localization
我正在寻找有关如何在我的 Android 应用程序中为各种语言环境(例如芬兰语、法语等)设置日期和时间格式的文档。我在 Android 的文档中找不到此信息。
【问题讨论】:
标签: android localization
// (1) get today's date
Date today = Calendar.getInstance().getTime();
// (2) create our date "formatter" (the date format we want)
SimpleDateFormat formatter = new SimpleDateFormat("EEE MMM dd hh:mm:ss yyyy");
// (3) create a new String using the date format we want
String result = formatter.format(today);
// (4) this prints "Result = Sun Sep 06 08:32:51 2009" in English and will be translated depending on phone Locale
System.out.println("Result = " + result);
来源:http://alvinalexander.com/java/simpledateformat-convert-date-to-string-formatted-parse
【讨论】: