Calendar cal = Calendar.getInstance();
//當前年
int year = cal.get(Calendar.YEAR);
//當前月
int month = (cal.get(Calendar.MONTH))+1;
//當前月的第幾天:即當前日
int day_of_month = cal.get(Calendar.DAY_OF_MONTH);
//當前時:HOUR_OF_DAY-24小時制;HOUR-12小時制
int hour = cal.get(Calendar.HOUR_OF_DAY);
//當前分
int minute = cal.get(Calendar.MINUTE);
//當前秒
int second = cal.get(Calendar.SECOND);
//0-上午;1-下午
int ampm = cal.get(Calendar.AM_PM);
//當前年的第幾周
int week_of_year = cal.get(Calendar.WEEK_OF_YEAR);
//當前月的第幾周
int week_of_month = cal.get(Calendar.WEEK_OF_MONTH);
//當前年的第幾天
int day_of_year = cal.get(Calendar.DAY_OF_YEAR);
名稱: ?4C.ESL | .↗Evon
口號: 遇到新問題?先要尋找一個方案乄而不是創造一個方案こ
mail: 聯系我