日历表的方式
Calendar now = Calendar.getInstance();
String time = now.get(Calendar.YEAR) + "-"
+ (now.get(Calendar.MONTH) + 1) + "-"
+ now.get(Calendar.DAY_OF_MONTH) + " "
+ now.get(Calendar.HOUR_OF_DAY) + ":"
+ now.get(Calendar.MINUTE) + ":" + now.get(Calendar.SECOND);
简单的时间格式
SimpleDateFormat formate=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String nowDate=formate.format(new Date());