废话少说,直接上代码:
Time mTime = new Time();
mTime.setToNow();
12小时制:
charSequence cs = DateFormat.format("hh:mm:ss",mTime.toMillis(true));
24小时制:
SimpleDateFormat sdf = new SimpleDateFormat("HH");
String cs = sdf.format(new Date());
PS:
对于24小时制值得注意的是HH一定要大写。小写则还是12小时制的显示。