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

The following examples show how to use org.joda.time.DateTime#toYearMonthDay() . These examples are extracted from open source projects. 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
@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
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
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
public static ExecutionSemester readByDateTime(final DateTime dateTime) {
    final YearMonthDay yearMonthDay = dateTime.toYearMonthDay();
    return readByYearMonthDay(yearMonthDay);
}
 
Example 5
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
@Override
public YearMonthDay getAdministrativeOfficeFeePaymentLimitDate(DateTime startDate, DateTime endDate) {
    return endDate.toYearMonthDay();
}
 
Example 7
public YearMonthDay getAdministrativeOfficeFeePaymentLimitDate(DateTime startDate, DateTime endDate) {
    return endDate.toYearMonthDay();
}