我正在寻找有关如何在Android应用中为各种区域设置(例如芬兰语,法语等)格式化日期和时间的文档。我在Android的文档中找不到这些信息。
答案 0 :(得分:0)
// (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