Java Day End getEndDate(int useMonth)

Here you can find the source of getEndDate(int useMonth)

Description

get End Date

License

Open Source License

Declaration

public static String getEndDate(int useMonth) 

Method Source Code

//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;
    }
}

Related

  1. getDistDates(Date startDate, Date endDate)
  2. getEndDate()
  3. getEndDate(Date beginDate, int resolution)
  4. getEndDate(Date date)
  5. getEndDate(Date startDate)
  6. getEndDate(String date)
  7. getEndDateByDate(Date date)
  8. getEndDateByYears(Date date, int years)
  9. getEndDateForYear()