Java examples for java.util:Week
get Week Start Date
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static Date getWeekStartDate(Date date) { if (date == null) { date = new Date(); }/* w w w . j a va 2s . c o m*/ Calendar cal = Calendar.getInstance(); cal.setTime(date); int week = cal.get(Calendar.DAY_OF_WEEK); if (week == 1) { cal.add(Calendar.DATE, -6); } else { cal.add(Calendar.DATE, (-week + 2)); } return cal.getTime(); } }