Here you can find the source of getEndDate(int useMonth)
public static String getEndDate(int useMonth)
//package com.java2s; /*/*from w w w. ja va 2 s .co m*/ * @(#)DateHelper.java Dec 31, 2012 * * Copyright (c) 2012 TH(ThreeHelp) Software Studio All rights reserved. * * This software is the confidential and proprietary information of TH(ThreeHelp) Software Studio * 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 TH(ThreeHelp) Software Studio * */ import java.util.Calendar; public class Main { /** * @return */ public static String getEndDate(int useMonth) { Calendar calendar = Calendar.getInstance(); int months = calendar.get(Calendar.MONTH); if (useMonth > 0) { calendar.set(Calendar.MONTH, useMonth + months); } int month = calendar.get(Calendar.MONTH) + 1; int day = calendar.get(Calendar.DAY_OF_MONTH); String ymd = calendar.get(Calendar.YEAR) + ""; if (month < 10) { ymd += "0" + month; } else { ymd += month; } if (day < 10) { ymd += "0" + day; } else { ymd += day; } return ymd; } }