Java Date After isAfterForDay(Date date, Date ref)

Here you can find the source of isAfterForDay(Date date, Date ref)

Description

check if date is after other date.

License

LGPL

Declaration

public static boolean isAfterForDay(Date date, Date ref) 

Method Source Code

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

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

public class Main {
    /**//from   w  w  w .  j  a v  a  2 s.c  o m
     * check if date is after other date.
     */
    public static boolean isAfterForDay(Date date, Date ref) {
        if (ref == null) {
            return true;
        }
        Calendar calDate = Calendar.getInstance();
        calDate.setTime(date);
        Calendar calRef = Calendar.getInstance();
        calRef.setTime(ref);
        if (calDate.get(Calendar.YEAR) < calRef.get(Calendar.YEAR)) {
            return false;
        } else if (calDate.get(Calendar.YEAR) == calRef.get(Calendar.YEAR)) {
            if (calDate.get(Calendar.DAY_OF_YEAR) <= calRef.get(Calendar.DAY_OF_YEAR)) {
                return false;
            }
        }
        return true;
    }
}

Related

  1. getNDayAfterCurrentDate(int n)
  2. getSpecifiedDayAfter(Date date, int num)
  3. getSpecifiedDayAfter4Date(Date date)
  4. isAfter(Date d1, Date d2)
  5. isAfter(Date date1, Date date2)
  6. isAfterHour(Date source, int hour)
  7. isAfterToday(Date dag)
  8. isDateAfter(Date date1, Date date2)
  9. isEqualOrAfterTomorrow(Date d)