开发者

How to use the date format that has been setup as default in Settings?

As you probably know, you can setup date format in the S开发者_如何学Pythonettings of an Android device.

In code how do we make sure that we use that format for date display?


Try android.text.format.DateFormat, notably getDateFormatOrder() to get the user's preferred date format.


You can retrieve both the date format as well as the time format like this:

DateFormat timeFormat;
DateFormat dateFormat;

dateFormat = android.text.format.DateFormat.getDateFormat(context);
timeFormat = android.text.format.DateFormat.getTimeFormat(context);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜