Java Hour tomrrow(int hour, int minute, int second)

Here you can find the source of tomrrow(int hour, int minute, int second)

Description

tomrrow

License

Artistic License

Declaration

public static Date tomrrow(int hour, int minute, int second) 

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 tomrrow(int hour, int minute, int second) {
        return nextDay(1, hour, minute, second);
    }//from w  ww  . j a v  a  2s.c  om

    public static Date nextDay(int day) {
        Calendar now = now();

        day = now.get(Calendar.DAY_OF_MONTH) + day;
        return year(now.get(Calendar.MONTH), day, now.get(Calendar.HOUR_OF_DAY), now.get(Calendar.MINUTE),
                now.get(Calendar.SECOND));
    }

    public static Date nextDay(int day, int hour, int minute, int second) {
        Calendar now = now();

        day = now.get(Calendar.DAY_OF_MONTH) + day;
        return year(now.get(Calendar.MONTH), day, hour, minute, second);
    }

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

        return now;
    }

    public static Date year(int month, int day, int hour, int minute, int second) {
        Calendar now = now();
        return new GregorianCalendar(now.get(Calendar.YEAR), month, day, hour, minute, second).getTime();
    }
}

Related

  1. hoursAndMinsToMilliseconds(int sign, int hours, int minutes)
  2. isHour(int hour)
  3. nextHour(Date date)
  4. nextHour(int hour)
  5. resetHourMillisToZero(long millis)