标签:
Calendar calendar = Calendar.getInstance();
//当天日期
calendar.setTime(new Date());
//前一天的日期
calendar.add(Calendar.DATE, -1);
String yestedayDate = format1.format(calendar.getTime());
int dow=calendar.get(Calendar.DAY_OF_WEEK)-2; //这里应该是不减或减1,不知道为什么-2才对上
if(dow==7) dow=0;
//本周最小日期
calendar.add(Calendar.DAY_OF_YEAR, -dow);
String strDate=format1.format(calendar.getTime());
//本周最大日期
calendar.add(Calendar.DAY_OF_YEAR, 6);
strDate=format1.format(calendar.getTime());
标签:
原文地址:http://www.cnblogs.com/xlj227/p/5798156.html