simpledateformat format = new simpledateformat ("Yyyy-MM-dd"); //get the first day of the previous month calendar cal_1=calendar.getinstance ();// Gets the current date cal_1.add (calendar.month, -1); cal_1.set (calendar.day_of_month,1);//set to number 1th, current date is the first day of the month firstday = format.format (Cal_1.gettime ());      SYSTEM.OUT.PRINTLN ("-----1------firstday:" +firstday); //get the last day of the previous month calendar cale = calendar.getinstance (); cale.set ( calendar.day_of_month,0);//set to number 1th, the current date is the first day of the month lastday = format.format (Cale.getTime ());        SYSTEM.OUT.PRINTLN ("-----2------Lastday:" +lastday); //gets the first day of the current month: calendar c = calendar.getinstance (); c.add ( calendar.month, 0); c.set (Calendar.DAY_OF_MONTH,1);//set to number 1th , the current date is both the first day of the month string first = format.format ( C.gettime ()); system.out.println ("===============first:" +first) ; //gets the last day of the current month &nbSp; calendar ca = calendar.getinstance (); ca.set (Calendar.day_of_month, ca.getactualmaximum (Calendar.DAY_OF_ MONTH)); string last = format.format (Ca.gettime ()); system.out.println ("===============last:" +last) ;