我想得到“短约会”的模式作为String
根据用户的区域设置进行自定义(例如“E dd MMM”)。我可以轻松获得本地化的DateFormat
- 对象使用
DateFormat mDateFormat = android.text.format.DateFormat.getDateFormat(mContext);
but DateFormat
没有.toPattern()
-method.
If I use
SimpleDateFormat sdf = new SimpleDateFormat();
String mDateFormatString = sdf.toPattern();
我不知道如何才能获得short日期模式字符串而不是完整的M/d/yy h:mm a
我最终使用了
String deviceDateFormat = DateFormat.getBestDateTimePattern(Locale.getDefault(), "E dd MMM");
将为我提供所提供的输入格式的“最佳区域表示”,在本例中为工作日、日期和月份。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)