Android Date Set offsetDay(Date date, int offset)

Here you can find the source of offsetDay(Date date, int offset)

Description

offset Day

Declaration

public static Date offsetDay(Date date, int offset) 

Method Source Code

//package com.java2s;

import java.util.Calendar;
import java.util.Date;

public class Main {
    public static Date offsetDay(Date date, int offset) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);/*from   w  ww .j av  a2 s . c o  m*/
        calendar.set(Calendar.DAY_OF_YEAR,
                (calendar.get(Calendar.DAY_OF_YEAR) + offset));
        return calendar.getTime();
    }
}

Related

  1. ceiling(Calendar date, int field)
  2. ceiling(Date date, int field)
  3. ceiling(Object date, int field)
  4. offsetHour(Date date, int offset)
  5. set(Date date, int calendarField, int amount)
  6. setDays(Date date, int amount)
  7. setHour(Date date, int hours)