DateUtils2 { public long expireAtWeek(int addWeek, int atWeekDay, int atHour, int atMin) { long curTime = System.currentTimeMillis(); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, 7 * addWeek); calendar.set(Calendar.DAY_OF_WEEK, atWeekDay == 7 ? 1 : atWeekDay + 1); calendar.set(Calendar.HOUR_OF_DAY, atHour); calendar.set(Calendar.MINUTE, atMin); long result = (calendar.getTimeInMillis() - curTime) / 1000; return result; }  long expireAtDay(int addDay, int atHour, int atMin); long expireAtHour(int addHour, int atMin); long expireAtMin(int addMin); long expireAtWeek(int addWeek, int atWeekDay, int atHour, int atMin); long expireAtMonth(int addMonth, int atDay, int atHour, int atMin);  }
@Test public void test4() throws Exception { long result = expireAtWeek(0, 1, 1, 30); long time = System.currentTimeMillis() + result * 1000; Date date = new Date(time); System.out.println(DateFormatUtils.format(date, "yyyy-MM-dd HH:mm:ss")); }