Here you can find the source of getDateForCurrentWeekDay(int day)
public static Date getDateForCurrentWeekDay(int day)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static Date getDateForCurrentWeekDay(int day) { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 0); // ! clear would not reset the hour of day ! cal.clear(Calendar.MINUTE); cal.clear(Calendar.SECOND); cal.clear(Calendar.MILLISECOND); cal.set(Calendar.DAY_OF_WEEK, day); return cal.getTime(); }//w w w. ja va 2 s . c o m public static Date getDateForCurrentWeekDay(Date date, int day) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.DAY_OF_WEEK, day); return cal.getTime(); } public static long getTime() { Date d = new Date(); return (d.getTime()); } public static long getTime(Date d) { return (d.getTime()); } public static Date setTime(Date d, long time) { d.setTime(time); return (d); } }