Thursday, March 19, 2009

How do I get the date of first day of the current week?

Use the Calendar class to set the day of the week to the first day of the week.

Calendar cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_WEEK,
cal.getActualMinimum(Calendar.DAY_OF_WEEK));
Date firstDayOfTheWeek = cal.getTime();

No comments: