Compare based on month day year
@param compared the day to compare
@return if compared is the same day
434977
public boolean isSameDay(Day compared)
  {
	  if(compared == null)
		  return false;
	 
  	return this.getMonth() == compared.getMonth()
  	&& this.getDayOfMonth() == compared.getDayOfMonth()
  	&& this.getYear() == compared.getYear();
  }
925924
public static boolean sameMonth(Date dateOne, Date dateTwo) {
        if ((dateOne == null) || (dateTwo == null)) {
            return false;
        }

        Calendar cal = Calendar.getInstance();
        cal.setTime(dateOne);
        int year = cal.get(Calendar.YEAR);
        int month = cal.get(Calendar.MONTH);

        cal.setTime(dateTwo);
        int year2 = cal.get(Calendar.YEAR);
        int month2 = cal.get(Calendar.MONTH);

        return ( (year == year2) && (month == month2) );
    }
666103
public static boolean isValidDate(final int year, final int month, final int day) {
		try {
			buildDate(year, month, day);
			return true;
		} catch (IllegalFieldValueException e) {
			if (LOG.isTraceEnabled()) {
				LOG.trace("", e);
			}
			return false;
		}
	}
1104121
@Override public int compareTo(Annotation that) {
    if (this == that) return 0;
    int byTimestamp = timestamp() < that.timestamp() ? -1 : timestamp() == that.timestamp() ? 0 : 1;
    if (byTimestamp != 0) return byTimestamp;
    return value().compareTo(that.value());
  }
288085
public function equals($objcDateTime = null)
    {
        if ($objcDateTime == null) {
            return false;
        }
        
        $diff_year = $this->adate['year'] - $objcDateTime->adate['year'];
        $diff_mon = $this->adate['mon'] - $objcDateTime->adate['mon'];
        $diff_day = $this->adate['mday'] - $objcDateTime->adate['mday'];
        
        if ($diff_year > 0) {
            return 1;
        }
        elseif ($diff_year < 0) {
            return -1;
        }
        elseif ($diff_mon > 0) {
            return 1;
        }
        elseif ($diff_mon < 0) {
            return -1;
        }
        elseif ($diff_day > 0) {
            return 1;
        }
        elseif ($diff_day < 0) {
            return -1;
        }
        else {
            return 0;
        }
    }
622880
private int compareDate(Date a, Date b) {
		final Date ta = new Date(a.getTime());
		final Date tb = new Date(b.getTime());
		final long d1 = setHourToZero(ta).getTime();
		final long d2 = setHourToZero(tb).getTime();
		return (int) Math.round((d2 - d1) / 1000.0 / 60.0 / 60.0 / 24.0);
	}
442937
public static int compare(Date left, double right) {
	return compare(left.getTime() / 1000, DateTimeUtil.getInstance().toDateTime(right).getTime() / 1000);
    }
358405
private static boolean isEquivalentDateRule(int month, int weekInMonth, int dayOfWeek, DateTimeRule dtrule) {
        if (month != dtrule.getRuleMonth() || dayOfWeek != dtrule.getRuleDayOfWeek()) {
            return false;
        }
        if (dtrule.getTimeRuleType() != DateTimeRule.WALL_TIME) {
            // Do not try to do more intelligent comparison for now.
            return false;
        }
        if (dtrule.getDateRuleType() == DateTimeRule.DOW
                && dtrule.getRuleWeekInMonth() == weekInMonth) {
            return true;
        }
        int ruleDOM = dtrule.getRuleDayOfMonth();
        if (dtrule.getDateRuleType() == DateTimeRule.DOW_GEQ_DOM) {
            if (ruleDOM%7 == 1 && (ruleDOM + 6)/7 == weekInMonth) {
                return true;
            }
            if (month != Calendar.FEBRUARY && (MONTHLENGTH[month] - ruleDOM)%7 == 6
                    && weekInMonth == -1*((MONTHLENGTH[month]-ruleDOM+1)/7)) {
                return true;
            }
        }
        if (dtrule.getDateRuleType() == DateTimeRule.DOW_LEQ_DOM) {
            if (ruleDOM%7 == 0 && ruleDOM/7 == weekInMonth) {
                return true;
            }
            if (month != Calendar.FEBRUARY && (MONTHLENGTH[month] - ruleDOM)%7 == 0
                    && weekInMonth == -1*((MONTHLENGTH[month] - ruleDOM)/7 + 1)) {
                return true;
            }
        }
        return false;
    }
59152
public boolean isSameDate(CalendarDate date) {
        return getDayOfWeek() == date.getDayOfWeek()
            && getMonth() == date.getMonth()
            && getYear() == date.getYear()
            && getEra() == date.getEra();
    }
1120461
static long comparable(DateValue dv) {
        long comp = (((((long) dv.year()) << 4) + dv.month()) << 5) + dv.day();
        if (dv instanceof TimeValue) {
            TimeValue tv = (TimeValue) dv;
            // We add 1 to comparable for timed values to make sure that timed
            // events are distinct from all-day events, in keeping with
            // DateValue.compareTo.

            // It would be odd if an all day exclusion matched a midnight event on
            // the same day, but not one at another time of day.
            return (((((comp << 5) + tv.hour()) << 6) + tv.minute()) << 6)
                    + tv.second() + 1;
        } else {
            return comp << 17;
        }
    }
750753
@Override
	public int compareTo(News o) {
		int diff = o.getPubDate().compareTo(getPubDate());
		if(diff != 0) return diff;
		return getPage().compareTo(o.getPage());
	}
541675
@Override
  public int compareTo(Annotation note) {
    return start_time > note.start_time ? 1 : 
      start_time < note.start_time ? -1 : 0;
  }
467302
@Override
    public int compare(final Issue i1, final Issue i2) {

        if (null == i1 && null == i2) {
            return 0;
        } else if (null == i1) {
            return 1;
        } else if (null == i2) {
            return -1;
        } else {
            return i1.getCreatedOn().compareTo(i2.getCreatedOn());
        }
    }
336979
public boolean match(int value, int month, boolean isLeapYear) {
		return (super.match(value) // 在约定日范围内的某一天
				//匹配器中用户定义了最后一天（32表示最后一天）
				|| (value > 27 && match(32) && isLastDayOfMonth(value, month, isLeapYear)));
	}
901858
public static boolean isSameMonth(final Date date1, final Date date2) {
        final Calendar cal1 = Calendar.getInstance();
        cal1.setTime(date1);

        final Calendar cal2 = Calendar.getInstance();
        cal2.setTime(date2);

        return cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA)
                && cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR)
                && cal1.get(Calendar.MONTH) == cal2.get(Calendar.MONTH);
    }
1230619
public static boolean sameDay(Date dateOne, Date dateTwo) {
        if ((dateOne == null) || (dateTwo == null)) {
            return false;
        }

        Calendar cal = Calendar.getInstance();
        cal.setTime(dateOne);
        int year = cal.get(Calendar.YEAR);
        int day = cal.get(Calendar.DAY_OF_YEAR);

        cal.setTime(dateTwo);
        int year2 = cal.get(Calendar.YEAR);
        int day2 = cal.get(Calendar.DAY_OF_YEAR);

        return ( (year == year2) && (day == day2) );
    }
954878
public boolean isStatisticExistsForApplicationAndAccountAndDate(final Application application,
							final Account account, final Date date) {
		final Calendar dateAsCal = new GregorianCalendar();
		dateAsCal.setTime(date);
		final int year = dateAsCal.get(Calendar.YEAR);
		// +1 because in calendar Junary is 0, not 1
		final int month = dateAsCal.get(Calendar.MONTH) + 1;
		final int day = dateAsCal.get(Calendar.DAY_OF_MONTH);
		
		final StringBuilder hql = new StringBuilder(200);
		hql.append("select stats from Statistic as stats ");
		hql.append(" where stats.id.App.id = :app_id and ");
		hql.append("       stats.id.Acc.id = :acc_id and ");
		hql.append("       year(stats.id.Month) = :year and");
		hql.append("       month(stats.id.Month) = :month and");
		hql.append("       day(stats.id.Month) = :day");
		
		final Query query = getCurrentSession().createQuery(hql.toString());
		query.setInteger("app_id", application.getId());
		query.setInteger("acc_id", account.getId());
		query.setInteger("year", year);
		query.setInteger("month", month);
		query.setInteger("day", day);
		return query.uniqueResult() != null;
	}