Time mTime = new Time();
mTime.setToNow();
CharSequence mCharSequence;
String style = "";
if (hour >= 0 && hour < 12) {
style = "AM";
} else if (hour >= 12) {
style = "PM";
}
if (android.text.format.DateFormat.is24HourFormat(mContext)) {
mCharSequence = DateFormat.format("kk:mm", mTime.toMillis(false));
} else {
mCharSequence = DateFormat.format("hh:mm", mTime.toMillis(false)) + " " + style;
}
Android Format android format12Hour
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Android Studio如何Format代码
Android Studio如何Format代码
Format代码 Android Studio