根据传入的date,取得上一周的周一、周五日期
java 代码
java 代码
SimpleDateFormat _formatYMD = new SimpleDateFormat("yyyyMMdd");
Calendar _calendar = Calendar.getInstance();
try{
_calendar.setTime(_formatYMD.parse(date));
int x = _calendar.get(Calendar.DAY_OF_WEEK) + 5;
_calendar.add(Calendar.DAY_OF_YEAR,-x);
startDate = _formatYMD.format(_calendar.getTime());
_calendar.add(Calendar.DAY_OF_YEAR,4);
endDate = _formatYMD.format(_calendar.getTime());
}catch(ParseException e){
e.printStackTrace();
}