android 设置时间12/24小时制
SimpleDateFormat sDateFormat ;
String date;
if(DateFormat.is24HourFormat(getActivity().getApplicationContext())){
sDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
date = sDateFormat.format(new java.util.Date());
}else{
sDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
date = sDateFormat.format(new java.util.Date()) + getPeroidText();
}
private CharSequence getPeroidText(){
String am_pm =Calendar.getInstance().getTime().getHours() >= 12 ? "PM" : "AM";
return am_pm;
}