判断是否24小时制
public boolean is24Hour() {
String strTimeFormat = android.provider.Settings.System.getString(mContext.getContentResolver(),android.provider.Settings.System.TIME_12_24);
if (strTimeFormat == null) {
if (DateFormat.is24HourFormat(mContext)) {
return true;
} else {
return false;
}
}
if(strTimeFormat.equals("24")) {
return true;
} else {
return false;
}
}
time.setText((new SimpleDateFormat("hh:mm")).format(new Date(message.msgTime)));
HH大写为24小时制
hh小写为12小时制