Java obtains the last day of a week and the last day of java.
Package test; import java. text. simpleDateFormat; import java. util. calendar;/*** ClassName: LastDayOfWeek * @ Description: TODO * @ author Owen * @ date July 15, December 22, 2015 */public class LastDayOfWeek {/*** obtain the last day of a week of a year * @ Title: getLastDayOfWeek * @ Description: * @ param: @ param year * @ param: @ param week * @ param: @ return * @ return: String * @ throws */public static String getLastDayOfWeek (int year, int week) {Calendar cal = Calendar. getInstance (); // set the year cal. set (Calendar. YEAR, year); // set weekly cal. set (Calendar. WEEK_OF_YEAR, week); // set the first day of the week to Monday cal. setFirstDayOfWeek (Calendar. MONDAY); // set the last day to Sunday cal. set (Calendar. DAY_OF_WEEK, cal. getFirstDayOfWeek () + 6); // Sunday // format the date SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd"); String lastDayOfWeek = sdf. format (cal. getTime (); return lastDayOfWeek;}/*** @ Title: main * @ Description: * @ param: @ param args * @ return: void * @ throws */public static void main (String [] args) {String lastDay = getLastDayOfWeek (13722); System. out. println ("the last day of week 1, 22nd is:" + lastDay );}}