Java Code Examples for org.joda.time.DateTime#toYearMonthDay()

The following examples show how to use org.joda.time.DateTime#toYearMonthDay() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UnitGroup.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public boolean isMember(User user, DateTime when) {
    if (user == null) {
        return false;
    }
    YearMonthDay whenYMD = when.toYearMonthDay();
    for (Accountability accountability : user.getPerson().getParentsSet()) {
        if (accountability.getAccountabilityType().getType() == relationType && accountability.isActive(whenYMD)) {
            if (accountability.getParentParty().equals(unit)) {
                return true;
            } else if (includeSubUnits && isAncestor(unit, accountability.getParentParty(), relationType, whenYMD)) {
                return true;
            }
        }
    }
    return false;
}
 
Example 2
Source File: TestGJChronology.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testSubtractDays() {
    // This is a test for a bug in version 1.0. The dayOfMonth range
    // duration field did not match the monthOfYear duration field. This
    // caused an exception to be thrown when subtracting days.
    DateTime dt = new DateTime
        (1112306400000L, GJChronology.getInstance(DateTimeZone.forID("Europe/Berlin")));
    YearMonthDay ymd = dt.toYearMonthDay();
    while (ymd.toDateTimeAtMidnight().getDayOfWeek() != DateTimeConstants.MONDAY) { 
        ymd = ymd.minus(Period.days(1));
    }
}
 
Example 3
Source File: TestGJChronology.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testSubtractDays() {
    // This is a test for a bug in version 1.0. The dayOfMonth range
    // duration field did not match the monthOfYear duration field. This
    // caused an exception to be thrown when subtracting days.
    DateTime dt = new DateTime
        (1112306400000L, GJChronology.getInstance(DateTimeZone.forID("Europe/Berlin")));
    YearMonthDay ymd = dt.toYearMonthDay();
    while (ymd.toDateTimeAtMidnight().getDayOfWeek() != DateTimeConstants.MONDAY) { 
        ymd = ymd.minus(Period.days(1));
    }
}
 
Example 4
Source File: ExecutionSemester.java    From fenixedu-academic with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static ExecutionSemester readByDateTime(final DateTime dateTime) {
    final YearMonthDay yearMonthDay = dateTime.toYearMonthDay();
    return readByYearMonthDay(yearMonthDay);
}
 
Example 5
Source File: FixedAmountPenaltyExemption.java    From fenixedu-academic with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void init(EventExemptionJustificationType justificationType, Event event, Person responsible, String reason, DateTime dispatchDate, Money value) {
    setValue(value);
    super.init(justificationType, event, responsible, reason, dispatchDate == null ? null : dispatchDate.toYearMonthDay());
}
 
Example 6
Source File: InsurancePR.java    From fenixedu-academic with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public YearMonthDay getAdministrativeOfficeFeePaymentLimitDate(DateTime startDate, DateTime endDate) {
    return endDate.toYearMonthDay();
}
 
Example 7
Source File: PastAdministrativeOfficeFeeAndInsurancePR.java    From fenixedu-academic with GNU Lesser General Public License v3.0 4 votes vote down vote up
public YearMonthDay getAdministrativeOfficeFeePaymentLimitDate(DateTime startDate, DateTime endDate) {
    return endDate.toYearMonthDay();
}