Here you can find the source of getWorkMonthLastDay(Date date)
public static Date getWorkMonthLastDay(Date date)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static Date getWorkMonthLastDay(Date date) { Calendar temp = Calendar.getInstance(); temp.setTime(date);/*w ww .ja v a 2 s . c o m*/ int y = temp.get(Calendar.YEAR); int m = temp.get(Calendar.MONTH) + 1; int d = temp.get(Calendar.DAY_OF_MONTH); int ry = 0, rm = 0, rd = 0; if (d >= 1 && d <= 20) { rm = m; ry = y; } if (d >= 21) { if (m == 12) { ry = y + 1; rm = 1; } else { rm = m + 1; ry = y; } } rd = 20; String sj1 = String.valueOf(ry) + "-" + String.valueOf(rm) + "-" + String.valueOf(rd); SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd"); Date r_date = null; try { r_date = myFormatter.parse(sj1); } catch (ParseException e) { e.printStackTrace(); } return r_date; } }