(一)
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy年MM月dd日 HH:mm:ss");
Date curDate = new Date(System.currentTimeMillis());
String time = formatter.format(curDate);
(二)
final Calendar c = Calendar.getInstance();
String time = c.get(Calendar.YEAR)+"年"+c.get(Calendar.MONTH)+"月"+c.get(Calendar.DAY_OF_MONTH)+"日";

String time = cal.get(Calendar.DAY_OF_MONTH) +":"+cal.get(Calendar.HOUR_OF_DAY) +":"+cal.get(Calendar.MINUTE)

  本人发布的内容均为学习中用过的代码,上传主要为了方便以后的复习和为他人提供一些方便,一些代码没有上下文,新学的朋友有不懂或存在问题的地方可以留言。