Java examples for java.util:Week
due In One Week
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static void main(String[] argv) throws Exception { Date date = new Date(); System.out.println(dueInOneWeek(date)); }/* w w w . jav a 2 s. c om*/ public static boolean dueInOneWeek(Date date) { Calendar cal = getTodayMidnight(); cal.add(Calendar.WEEK_OF_YEAR, 1); return (date.getTime() <= cal.getTimeInMillis()); } public static Calendar getTodayMidnight() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal; } }