Java Hour getHourAfter(final Date _from, final int _hours)

Here you can find the source of getHourAfter(final Date _from, final int _hours)

Description

get Hour After

License

Apache License

Declaration

public static Date getHourAfter(final Date _from, final int _hours) 

Method Source Code

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

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

public class Main {

    public static Date getHourAfter(final Date _from, final int _hours) {
        return getDateTimeAfter(_from, Calendar.HOUR_OF_DAY, _hours);
    }/*from   w  w  w .  j ava  2s .com*/

    public static Date getDateTimeAfter(final Date _from, final int _time_type, final int _count) {
        final Calendar c = Calendar.getInstance();
        if (_from != null) {
            c.setTime(_from);
        }
        c.add(_time_type, _count);
        return c.getTime();
    }
}

Related

  1. getHour(long t)
  2. getHour(String dateString)
  3. getHour(String dateTime)
  4. getHour12(Date date)
  5. getHourAfter(Date date, int hour)
  6. getHourAndMin(long time)
  7. getHourAndMinutes(Date dt)
  8. getHourBeforeTime(int hour)
  9. getHourByZore(int hour)