/**
* 取得当前日期所在周的第一天
*/
public Date getFirstDayOfWeek(Date date)
{
Calendar c = Calendar.getInstance();
c.setFirstDayOfWeek(Calendar.MONDAY);
c.setTime(date);
c.set(Calendar.DAY_OF_WEEK, c.getFirstDayOfWeek()); // 星期一
return c.getTime ();
}
/**
* 取得当前日期所在周的最后一天
*/
public Date getLastDayOfWeek(Date date)
{
Calendar c = Calendar.getInstance();
c.setFirstDayOfWeek(Calendar.MONDAY);
c.setTime(date);
c.set(Calendar.DAY_OF_WEEK, c.getFirstDayOfWeek() + 6); //星期天
return c.getTime();
}