Idea:
Get the start and end date of the current quarter, and push 3 months on the basis of the current date, the beginning and end of the last quarter
/ *** @Param Flag True: Start Date; False: End Date* @Return*/ Public Static String GetlastquartErtime (Boolean Flag) ORMAT ("Yyyy-MM-DD"); SimpleDateFormat Longsdf = New SimpleDateFormat ; Alendar.month) + 1 ; // True: Start Date; FALSE: Ending Date IF (FLAG) {if (Currentmonth> = 1 && CURrentMonth <= 3) Calendar.Set (Calendar.month, 0); Else if (Currentmonth> = 4 && Curren. TmNTH < = 6) Calendar.Set (Calendar.month, 3); Else if (CurrenTmonth> = 7 & & CurrenTmonth <= 9) Calendar.Set (Calendar.month, 6); Else if (CurrentMonth> = 10 && CUR. Rentmonth <= 12 ) Calendar.Set (Calendar.month, 9); Calendar.set (Calendar.date, 1); Now = Longsdf.parse (Shortsdf.Format (Calendar.gettime ())); 00:00:00 ");} Else {if (CurrenTmonth> = 1 && CURRENTMONTH <= 3) {Calendar.Set (Calendar.month, 2); Calendar.date, 31); urrentmonth <= 6 ) {Calendar.Set (Calendar.month, 5); Calendar.Set (Calendar.date, 30);} Else if (CurrenTmonth> = 7 && CurrenTmonth <= 9) {Calendar.Month, 8 ); Calendar.set (Calendar.date, 30);} Else If (CurrenTmonth> = 10 && CurrenTmonth <= 12) {Calendar.Set (Calendar.month, 11); Calendar.DATE (31); } Now = Longsdf.parse (Shortsdf.Format (Calendar.gettime ()) + "23:59:59");} Calendar.Settime (now); // set the date Calendar.add (CALENDAR.MONTH, -3); E = Longsdf.Format (Calendar.gettime ());} Catch (Exception E) {;} Return Resultdate;}