Java Year Get getDateOneYearFromNow()

Here you can find the source of getDateOneYearFromNow()

Description

get Date One Year From Now

License

Open Source License

Declaration

public final static String getDateOneYearFromNow() 

Method Source Code

//package com.java2s;
/**/*from w  ww.j av  a 2s  . c o m*/
 * @copyright Copyright (C) 2014-2016 City of Bloomington, Indiana. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
 * @author W. Sibo <sibow@bloomington.in.gov>
 *
 */

import java.util.*;

public class Main {
    public final static String getDateOneYearFromNow() {

        String day = "", month = "", year = "";
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.YEAR, 1);
        int mm = (cal.get(Calendar.MONTH) + 1);
        int dd = cal.get(Calendar.DATE);
        year = "" + cal.get(Calendar.YEAR);
        if (mm < 10)
            month = "0";
        month += mm;
        if (dd < 10)
            day = "0";
        day += dd;
        return month + "/" + day + "/" + year;
    }
}

Related

  1. getBeginningOfYear()
  2. getCalendarYearString(Calendar date)
  3. getCurrentYear()
  4. getCurrentYearAsInt()
  5. getCurrYearFirst()
  6. getDaysFromYearZero(Calendar date)
  7. getFewYearsTime(String date, int year)
  8. getHalfYearEndDate(Date date)
  9. getLastDayOfYear(Date date)