Java Date Before isAtLeastOneDayBefore(Date daybefore, Date dayafter)

Here you can find the source of isAtLeastOneDayBefore(Date daybefore, Date dayafter)

Description

is At Least One Day Before

License

Open Source License

Declaration

public static boolean isAtLeastOneDayBefore(Date daybefore, Date dayafter) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    public static boolean isAtLeastOneDayBefore(Date daybefore, Date dayafter) {
        Calendar calBefore = Calendar.getInstance();
        Calendar calAfter = Calendar.getInstance();
        calBefore.setTime(daybefore);//w  w w  . j ava  2s .  c  o  m
        calAfter.setTime(dayafter);
        return calBefore.get(Calendar.YEAR) == calAfter.get(Calendar.YEAR)
                && calBefore.get(Calendar.DAY_OF_YEAR) + 1 <= calAfter.get(Calendar.DAY_OF_YEAR);
    }
}

Related

  1. getOneHourBefore(Date date)
  2. getPassedMonthBetweenDate(Date before, Date after)
  3. getPreviousDate(String before)
  4. getQuarterStartDateBeforeCurrent(int num, Date current)
  5. getSomeDaysBeforeAfter(Date date, int days)
  6. isBefore(Date date)
  7. isBefore(Date date1, Date date2)
  8. isBefore2015(Date date)
  9. isBefore_day(Date time1, Date time2, int days)