Java Year Month getAddedDate(Date date, int addYear, int addMonth, int addDay, int addHour, int addMinute, int addSecond)

Here you can find the source of getAddedDate(Date date, int addYear, int addMonth, int addDay, int addHour, int addMinute, int addSecond)

Description

get Added Date

License

Open Source License

Declaration

public static Date getAddedDate(Date date, int addYear, int addMonth, int addDay, int addHour, int addMinute,
        int addSecond) 

Method Source Code

//package com.java2s;

import java.util.*;

public class Main {

    public static Date getAddedDate(Date date, int addYear, int addMonth, int addDay, int addHour, int addMinute,
            int addSecond) {
        Calendar nowdate = new GregorianCalendar();
        nowdate.setTime(date);/*  ww  w.  j  a  v a2  s .c  o m*/
        nowdate.add(Calendar.YEAR, addYear);
        nowdate.add(Calendar.MONTH, addMonth);
        nowdate.add(Calendar.DAY_OF_MONTH, addDay);
        nowdate.add(Calendar.HOUR_OF_DAY, addHour);
        nowdate.add(Calendar.MINUTE, addMinute);
        nowdate.add(Calendar.SECOND, addSecond);
        return nowdate.getTime();
    }

    public static long getTime() {
        Date dt = new Date();
        return dt.getTime();
    }
}

Related

  1. createDate(int year, int month, int dayOfMonth)
  2. date(final int year, final int month, final int day, final int hour, final int minute, final int second)
  3. date(int year, int month, int day)
  4. Date2Long(int year, int month, int date)
  5. encodeDateTime(int year, int month, int day, int hour, int minutes, int seconds)
  6. getAllDate(String year_month)
  7. getBeginEndDayOfMonth(String yearMonthString)
  8. getCurrentYearMonthDay()
  9. getCurYearMonth()