Android Date Set offsetHour(Date date, int offset)

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

Description

offset Hour

Declaration

public static Date offsetHour(Date date, int offset) 

Method Source Code

//package com.java2s;

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

public class Main {
    public static Date offsetHour(Date date, int offset) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);// www  . ja v  a  2  s.com
        calendar.set(Calendar.HOUR_OF_DAY,
                (calendar.get(Calendar.HOUR_OF_DAY) + offset));
        return calendar.getTime();
    }
}

Related

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