Java Month of Year getTodayAdd(int year, int month, int day)

Here you can find the source of getTodayAdd(int year, int month, int day)

Description

get Today Add

License

Apache License

Declaration

public static String getTodayAdd(int year, int month, int day) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Calendar;

import java.util.GregorianCalendar;

public class Main {
    public static String getTodayAdd(int year, int month, int day) {
        String tmpstr = "";
        GregorianCalendar calendar = new GregorianCalendar();
        int yearnow = calendar.get(Calendar.YEAR) + year;
        int monthnow = calendar.get(Calendar.MONTH) + month;
        int daynow = calendar.get(Calendar.DAY_OF_MONTH) + day;
        tmpstr += yearnow + "-";
        if (monthnow < 10) {
            tmpstr += "0" + monthnow + "-";
        } else {//from  w  w  w  .j  a v a 2 s.c o m
            tmpstr += monthnow + "-";
        }
        if (daynow < 10) {
            tmpstr += "0" + daynow;
        } else {
            tmpstr += daynow;
        }
        return tmpstr;
    }
}

Related

  1. getStrDayOfWeek(int _year, int _month, int _day)
  2. getThisMonth(int year, int monthIndex)
  3. getTime(int year, int month, int day)
  4. getTimeByYMD(int year, int month, int day)
  5. getTimestamp(int year, int month, int day, int hour, int minute, int second, int millisecond)
  6. getWeek(int year, int month, int day)
  7. getWorkDayNum(int year, int month, int start, int end)
  8. isDefaultHolidays(int year, int month, int day)
  9. isWeekEnd(int year, int month, int day)