Android 如何根据设备/本地时区更改SimpleDataFormat

Android 如何根据设备/本地时区更改SimpleDataFormat,android,timezone,simpledateformat,Android,Timezone,Simpledateformat,我的代码: SimpleDateFormat today= new SimpleDateFormat("E, MMM dd, yyyy"); TimeZone tz = TimeZone.getDefault(); today.setTimeZone(tz); dt = today.format(c.getTimeInMillis()); time.setText("Today "+dt); 我的默认日期格式为2014年5月5日星期一 如果我将设备中的设置更改为格式:2014/12/3

我的代码:

SimpleDateFormat today= new SimpleDateFormat("E, MMM dd, yyyy");
 TimeZone tz = TimeZone.getDefault();
 today.setTimeZone(tz);
 dt = today.format(c.getTimeInMillis());
 time.setText("Today "+dt);
我的默认日期格式为2014年5月5日星期一

如果我将设备中的设置更改为格式:2014/12/31 然后,我应该以这种格式获得我的约会,比如2014年5月5日星期一
是否可能,如果是,如何…

不要使用SimpleDataFormat来解决您的问题。 使用以下命令:

DateFormat df = android.text.format.DateFormat.getTimeFormat(context);
这将为您提供手机设置的日期格式

在此之后,将您的输入日期输入:

DateUtils.format(...)

使用
df
作为模式。

您可以使用方法获取格式化的日期或符合本地约定的时间

这就是您今天所指的DateFormat=android.text.format.DateFormat.getTimeFormat(getActivity());DateUtils.formatDate(df,“E,MMM-dd,yyyy”);但它不以该格式显示..它只显示时间它仍以格式Mon,May 05,2014dt=DateUtils.formatDate(df,“E,MMM dd,yyyy”)显示;像这样?可能是复制品。使用
Settings.System.DATE\u格式的公认答案是有希望的。是..相同..但仍然..我的dbt是如果我选择我的设置日期格式为2014/12/11,我们可以将该日期格式设置为2014年5月5日星期一吗