Calendar 获取年 月 日 时 分 秒
Calendar calendar = Calendar.getInstance(); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH) + 1; int day = calendar.get(Calendar.DAY_OF_MONTH); int hour = calendar.get(Calendar.HOUR_OF_DAY); int minute = calendar.get(Calendar.MINUTE); int millisecond = calendar.get(Calendar.SECOND); System.out.print("运行时间:" + year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + millisecond);