Java examples for java.util:Day
get Monday Date
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static Date getMondayDate(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);/*www . j a va 2 s . co m*/ int day = calendar.get(Calendar.DAY_OF_WEEK); day = (day + 6) % 7; day = day == 0 ? 7 : day; calendar.add(Calendar.DAY_OF_YEAR, 1 - day); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar.getTime(); } }