Calendar的使用举个小栗子: //通过当前时间获取本周周一时间 Date date = new Date(); Calendar calendar = new GregorianCalendar(); calendar.setTime(date ); calendar.add(Calendar.DATE,i + 1 - (calendar.get(Calendar.DAY_OF_WEEK) - 1) ); date = calendar.getTime();…
Java Calendar获取年.月.日.时间 Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT+08:00")); //获取东八区时间 int year = c.get(Calendar.YEAR); //获取年 int month = c.get(Calendar.MONTH) + 1; //获取月份,0表示1月份 int day = c.get(Calendar.DAY_OF_MONTH);…