Example usage for org.apache.commons.lang.time DateUtils truncatedCompareTo

List of usage examples for org.apache.commons.lang.time DateUtils truncatedCompareTo

Introduction

In this page you can find the example usage for org.apache.commons.lang.time DateUtils truncatedCompareTo.

Prototype

public static int truncatedCompareTo(Date date1, Date date2, int field) 

Source Link

Document

Determines how two dates compare up to no more than the specified most significant field.

Usage

From source file:org.sonar.server.computation.issue.NewDebtCalculator.java

private static boolean isBeforeOrEqual(@Nullable Date changeDate, Date periodDate) {
    return (changeDate != null) && (DateUtils.truncatedCompareTo(changeDate, periodDate, Calendar.SECOND) <= 0);
}

From source file:service.PeriodServiceImpl.java

@Override
public Boolean includesDate(Period period, Date date) {
    if ((DateUtils.truncatedCompareTo(date, period.getStartDate(), Calendar.DAY_OF_MONTH) >= 0)
            && (DateUtils.truncatedCompareTo(date, period.getEndDate(), Calendar.DAY_OF_MONTH) <= 0)) {
        return true;
    }// ww w  .  j a  v  a  2  s  . co m
    return false;
}