Java Hour nextHour(int hour)

Here you can find the source of nextHour(int hour)

Description

next Hour

License

Artistic License

Declaration

public static Date nextHour(int hour) 

Method Source Code


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

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

public class Main {
    public static Date nextHour(int hour) {
        Calendar now = now();/*w ww. j  a  va 2 s.  co  m*/

        now.set(Calendar.HOUR_OF_DAY, now.get(Calendar.HOUR_OF_DAY) + hour);

        return now.getTime();
    }

    public static Calendar now() {
        Calendar now = new GregorianCalendar();
        now.setTimeInMillis(new Date().getTime());
        now.setTimeZone(TimeZone.getDefault());

        return now;
    }
}

Related

  1. Hours()
  2. hours(int hours)
  3. hoursAndMinsToMilliseconds(int sign, int hours, int minutes)
  4. isHour(int hour)
  5. nextHour(Date date)
  6. resetHourMillisToZero(long millis)
  7. tomrrow(int hour, int minute, int second)