Here you can find the source of getEndOfMonth(String year, String month)
public static String getEndOfMonth(String year, String month)
//package com.java2s; /**//w ww. j av a 2 s . co m * * Copyright (c) 2012 ChinaSoft International Co., Ltd. * All rights reserved. * This software is the confidential and proprietary information of * ChinaSoft International. ("Confidential Information"). * You shall not disclose such Confidential Information and shall use it * only in accordance with the terms of the license agreement you entered * into with ChinaSoft International. * * ????????? * 2012-5-21 ?? */ import java.util.Calendar; public class Main { public static String getEndOfMonth(String year, String month) { Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, Integer.parseInt(year)); cal.set(Calendar.MONTH, Integer.parseInt(month) - 1); return cal.getActualMaximum(Calendar.DAY_OF_MONTH) + ""; } }