0

さまざまなロケール(フィンランド語、フランス語など)のAndroidアプリで日付と時刻をフォーマットする方法に関するドキュメントを探しています。Androidのドキュメントでこの情報を見つけることができませんでした。

4

1 に答える 1

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

于 2012-12-09T22:12:55.693 に答える