获得当前周别所属年份
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
- Calendar cl = Calendar.getInstance();
- cl.setTime(sdf.parse("2012-12-31"));
- int week = cl.get(Calendar.WEEK_OF_YEAR);
- System.out.println(week);
- cl.add(Calendar.DAY_OF_MONTH, -7);
- int year = cl.get(Calendar.YEAR);
- if(week<cl.get(Calendar.WEEK_OF_YEAR)){
- year+=1;
- }