Java Date Before monthInRange(Date current, Date before, Date after)

Here you can find the source of monthInRange(Date current, Date before, Date after)

Description

month In Range

License

Apache License

Declaration

public static boolean monthInRange(Date current, Date before, Date after) 

Method Source Code

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

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

public class Main {
    public static boolean monthInRange(Date current, Date before, Date after) {
        Calendar curr = Calendar.getInstance();
        curr.setTime(current);/*  w  w w  .j a  va2 s  .  c  o  m*/
        Calendar temp = Calendar.getInstance();
        temp.setTime(before);
        temp.set(5, 1);
        temp.set(11, 0);
        temp.set(12, 0);
        temp.set(13, 0);
        if (curr.before(temp)) {
            return false;
        }
        temp.setTime(after);
        temp.add(2, 1);
        temp.set(5, 1);
        temp.set(11, 0);
        temp.set(12, 0);
        temp.set(13, 0);

        return !curr.after(temp);
    }
}

Related

  1. isBeforeCommonEra(Date date)
  2. isBeforeDate(long time1, long time2)
  3. isBeforeEndOfDate(Date subject, Date predicate)
  4. isDataBeforeData2TruncByDay(Date data1, Date data2)
  5. isDateBeforeCurrentDate(Date date)