ユーザーから、DatePickerDialog で設定した日付を取得します。取得する日付は次の形式です。
int selectedYear, int selectedMonth, int selectedDay
下の図のように、「日、月、日、年」のようにフォーマットできますか?
ユーザーから、DatePickerDialog で設定した日付を取得します。取得する日付は次の形式です。
int selectedYear, int selectedMonth, int selectedDay
下の図のように、「日、月、日、年」のようにフォーマットできますか?
これを試すことができます:
SimpleDateFormat sdf = new SimpleDateFormat("EEE-dd-MM-yyyy"); // Set your date format
String currentData = sdf.format(your actual date); // Get Date String according to date format
ここでは、詳細とサポートされているすべての形式を確認できます。
http://developer.android.com/reference/java/text/SimpleDateFormat.html
a を使用しSimpleDateFormat
て日付をフォーマットします。
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, selectedYear);
cal.set(Calendar.MONTH, selectedMonth);
cal.set(Calendar.DAY_OF_MONTH, selectedDay);
SimpleDateFormat sdf = new SimpleDateFormat();
String DATE_FORMAT = "EE, MMM dd, yyyy";
sdf.applyPattern(DATE_FORMAT);
String formattedDate = sdf.format(cal.getTime());