Android Date Offset getDateFormOffset(int months, int days, int hours, int minutes)

Here you can find the source of getDateFormOffset(int months, int days, int hours, int minutes)

Description

get Date Form Offset

Declaration

public static Calendar getDateFormOffset(int months, int days,
            int hours, int minutes) 

Method Source Code

//package com.java2s;
import java.util.Calendar;

public class Main {
    public static Calendar getDateFormOffset(int months, int days,
            int hours, int minutes) {
        Calendar selectedDate = getCurrentDate();
        selectedDate.add(Calendar.DAY_OF_MONTH, days);
        selectedDate.add(Calendar.MONTH, months);
        selectedDate.add(Calendar.HOUR_OF_DAY, hours);
        selectedDate.add(Calendar.MINUTE, minutes);
        return selectedDate;
    }//from w w  w .  j av  a 2 s  .c o  m

    public static Calendar getCurrentDate() {
        Calendar currDate = Calendar.getInstance();
        currDate.setTimeInMillis(System.currentTimeMillis());
        currDate.set(Calendar.MONTH, currDate.get(Calendar.MONTH) + 1);
        return currDate;
    }
}

Related

  1. getTimeWithFormat(int year, int month, int day, int hour, int minute)
  2. thirdDayWithHour()
  3. getDateAndTimeWithShortFormat(boolean withYear, int year, int month, int day, int hour, int minute)
  4. convertToUnixTimeOneDayLater(Date date)