private static final SimpleDateFormat format_date = new SimpleDateFormat (
Confighomehelper.getvaluebyconfig ("Format.date"));
/**
* Calculates the start date of a week for a year
*
* @param yearnum
* format yyyy
* @param weekNum
* 1 to 52 or
* @return date in YYYY-MM-DD
*/
public static String getyearweekfirstday (int yearno, int weekno) {
calendar cal = Calendar.getinstance ();
& Nbsp;cal.setfirstdayofweek (Calendar.sunday); Set the first day of the week for the Monday
cal.set (Calendar.day_of_week, calendar.sunday);//weekly starting from Monday
// The above two lines of code can be implemented, the first week of each year, is the week that contains the first Monday.
cal.setminimaldaysinfirstweek (7);//Set minimum 7 days per week
cal.set (calendar.year, Yearno);
cal.set (Calendar.week_of_year, Weekno);
//The year, month, day
return Format_date.format (Cal.gettime ()) of the current date respectively;
}
/**
* Calculates the end date of a week for a year
*
* @param yearnum
* format yyyy
* @param weekNum
* 1 to 52 or
* @return date in YYYY-MM-DD
*/
public static String getyearweekendday (int yearno, int weekno) {
calendar cal = Calendar.getinstance ();
&nbs P; cal.setfirstdayofweek (Calendar.sunday); Set the first day of the week for Monday
cal.set (calendar.day_of_week,calendar.saturday);//weekly from Monday
// The above two lines of code can be implemented, the first week of each year, is the week that contains the first Monday.
cal.setminimaldaysinfirstweek (7);//Set minimum 7 days per week
cal.set (calendar.year, Yearno);
cal.set (Calendar.week_of_year, Weekno);
return Format_date.format (Cal.gettime ());
}