@Test public void test() throws Exception { long result = expireAtDay(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")); }
public long expireAtDay(int addDay, int atHour, int atMin) { long curTime = System.currentTimeMillis(); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, addDay); calendar.set(Calendar.HOUR_OF_DAY, atHour); calendar.set(Calendar.MINUTE, atMin); long result = (calendar.getTimeInMillis() - curTime) / 1000; return result; }
DateUtils2 { public long expireAtDay(int addDay, int atHour, int atMin) { long curTime = System.currentTimeMillis(); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, addDay); calendar.set(Calendar.HOUR_OF_DAY, atHour); calendar.set(Calendar.MINUTE, atMin); long result = (calendar.getTimeInMillis() - curTime) / 1000; return result; } }
DateUtils2 { public long expireAtDay(int addDay, int atHour, int atMin) { long curTime = System.currentTimeMillis(); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, addDay); calendar.set(Calendar.HOUR_OF_DAY, atHour); calendar.set(Calendar.MINUTE, atMin); long result = (calendar.getTimeInMillis() - curTime) / 1000; return result; }  }
DateUtils2 { public long expireAtDay(int addDay, int atHour, int atMin) { long curTime = System.currentTimeMillis(); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, addDay); 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); }
DateUtils2 { public long expireAtDay(int addDay, int atHour, int atMin) { long curTime = System.currentTimeMillis(); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, addDay); 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);  }