Java Date After isAfterHour(Date source, int hour)

Here you can find the source of isAfterHour(Date source, int hour)

Description

is After Hour

License

Open Source License

Declaration

public static boolean isAfterHour(Date source, int hour) 

Method Source Code

//package com.java2s;
/**//  ww  w . j  a  v a  2  s. co m
 * Project: guahao-portal-web-home
 * 
 * File Created at 2012-9-26
 * 
 * Copyright 2012 Greenline.com Corporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Greenline Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Greenline.com.
 */

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

public class Main {

    public static boolean isAfterHour(Date source, int hour) {
        Calendar c = Calendar.getInstance();
        c.setTime(source);
        int hourOfDay = c.get(Calendar.HOUR_OF_DAY);
        if (hourOfDay - hour >= 0) {
            return true;
        } else {
            return false;
        }
    }
}

Related

  1. getSpecifiedDayAfter(Date date, int num)
  2. getSpecifiedDayAfter4Date(Date date)
  3. isAfter(Date d1, Date d2)
  4. isAfter(Date date1, Date date2)
  5. isAfterForDay(Date date, Date ref)
  6. isAfterToday(Date dag)
  7. isDateAfter(Date date1, Date date2)
  8. isEqualOrAfterTomorrow(Date d)
  9. isInSameDayOrAfter(Date d1, Date d2)