一种是使用java SimpleDateFormat
SimpleDateFormat format=new SimpleDateFormat("E,M d,yyyy"); mDateButton.setText(format.format(mCrime.getDate()));
另一种使用android.text.format.DateFormat
DateFormat df=DateFormat.getDateInstance(DateFormat.FULL, Locale.CHINA); mDateButton.setText(df.format(mCrime.getDate()));
SHORT
is completely numeric, such as12.13.52
or3:30pm
MEDIUM
is longer, such asJan 12, 1952
LONG
is longer, such asJanuary 12, 1952
or3:30:32pm
FULL
is pretty completely specified, such asTuesday, April 12, 1952 AD or 3:30:42pm PST
.