//获取系统时间
private String getTime() {
Time times = new Time("GMT+8");
times.setToNow();
int year = times.year;
int month = times.month;
int day = times.monthDay;
int minute = times.minute;
int hour = times.hour;
int sec = times.second;
String result = year + "-" + String.format("%02d", month) + "-" + String.format("%02d", day)
+ " " + String.format("%02d", hour) + ":" + String.format("%02d", minute) + ":" + String.format("%02d", sec);
return result;
}
private String getTime() {
Date date = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String result = dateFormat.format(date);
return result;
}
网友评论