Here you can find the source of dateOfYearBetween(final int month, final int dayOfMonth, final int fromMonth, final int fromDayOfMonth, final int toMonth, final int toDayOfMonth)
public static boolean dateOfYearBetween(final int month, final int dayOfMonth, final int fromMonth, final int fromDayOfMonth, final int toMonth, final int toDayOfMonth)
//package com.java2s; // ProjectForge is dual-licensed. public class Main { public static boolean dateOfYearBetween(final int month, final int dayOfMonth, final int fromMonth, final int fromDayOfMonth, final int toMonth, final int toDayOfMonth) { if (fromMonth == toMonth) { if (month != fromMonth) { return false; }//from ww w . ja v a 2 s. co m if (dayOfMonth < fromDayOfMonth || dayOfMonth > toDayOfMonth) { return false; } } else if (fromMonth < toMonth) { // e. g. APR - JUN if (month < fromMonth || month > toMonth) { // e. g. FEB or JUL return false; } else if (month == fromMonth && dayOfMonth < fromDayOfMonth) { return false; } else if (month == toMonth && dayOfMonth > toDayOfMonth) { return false; } } else if (fromMonth > toMonth) { // e. g. NOV - FEB if (month > toMonth && month < fromMonth) { // e. g. MAR return false; } else if (month == fromMonth && dayOfMonth < fromDayOfMonth) { return false; } else if (month == toMonth && dayOfMonth > toDayOfMonth) { return false; } } return true; } }