Example usage for org.joda.time DateTime year

List of usage examples for org.joda.time DateTime year

Introduction

In this page you can find the example usage for org.joda.time DateTime year.

Prototype

public Property year() 

Source Link

Document

Get the year property which provides access to advanced functionality.

Usage

From source file:uk.org.rbc1b.roms.scheduled.DailyVolunteerEmailScheduledService.java

License:Open Source License

/**
 * Helper method to find the maximum number of volunteers who
 * should receive the contact details email based on the six month
 * regularity of this service.//from   ww w. j av a  2s  .  c o  m
 *
 * @return integer of max number of volunteers
 */
private Integer findMaxVolunteersForEmail() {
    VolunteerSearchCriteria searchCriteria = new VolunteerSearchCriteria();
    searchCriteria.setMaxResults(null);
    int totalVolunteerCount = volunteerDao.findVolunteersCount(searchCriteria);
    final DateTime dateTime = new DateTime();

    if (dateTime.year().isLeap()) {
        return new BigDecimal(totalVolunteerCount)
                .divide(new BigDecimal(NUMBER_OF_DAYS_IN_LEAP_HALF_YEAR), RoundingMode.UP).intValue();
    }

    return new BigDecimal(totalVolunteerCount)
            .divide(new BigDecimal(NUMBER_OF_DAYS_IN_HALF_YEAR), RoundingMode.UP).intValue();
}