Java Hour Add addHH(Date date, int i)

Here you can find the source of addHH(Date date, int i)

Description

add HH

License

Apache License

Declaration

public static Date addHH(Date date, int i) 

Method Source Code

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

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

public class Main {

    public static Date addHH(Date date, int i) {
        if (date == null)
            return null;
        Calendar c = new GregorianCalendar();
        c.setTime(date);/*from  ww  w  . ja va 2  s  .co m*/
        c.add(Calendar.HOUR, i);
        return c.getTime();
    }
}

Related

  1. addHour(Date baseDate, int hour, TimeZone timezone)
  2. addHour(Date date, boolean up)
  3. addHour(java.util.Date d, int h)
  4. addHours(Date date, int hours)