android.provider.Settings.System.putString(getContentResolver(), android.provider.Settings.System.TIME_12_24, "12");//设置为12小时制
boolean is24Hour = true;
String szTimeFormat = android.provider.Settings.System.getString(getContentResolver(), android.provider.Settings.System.TIME_12_24);
if(szTimeFormat!=null && szTimeFormat.contains("12")) is24Hour = false;
SimpleDateFormat dateformat = new SimpleDateFormat(is24Hour?"aa HH:mm":"aa hh:mm",Locale.CHINA);
//SimpleDateFormat dateformat = new SimpleDateFormat("E aa HH:mm",Locale.CHINA);
String szTime = dateformat.format(new Date());
Calendar calendar = Calendar.getInstance(Locale.CHINA);
if(calendar.get(Calendar.AM_PM) == 0)//上午