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

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

Introduction

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

Prototype

int RANGE_WEEK_RELATIVE

To view the source code for org.apache.commons.lang.time DateUtils RANGE_WEEK_RELATIVE.

Click Source Link

Document

A week range, starting on the day focused.

Usage

From source file:org.kuali.kra.committee.web.CommitteeScheduleAddSeleniumTest.java

/**
 * Gets the next Monday date occurring after the given {@code startDate}.
 * //from ww  w.  ja v a2  s .  co  m
 * @param startDate the date to start at
 * @return the next Monday date occurring after the given {@code startDate}
 */
@SuppressWarnings("unchecked")
private Date getMonday(Date startDate) {
    Date monday = startDate;

    for (Iterator<Calendar> iter = DateUtils.iterator(startDate, DateUtils.RANGE_WEEK_RELATIVE); iter
            .hasNext();) {
        Calendar calendar = iter.next();
        if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY) {
            monday = calendar.getTime();
            break;
        }
    }

    return monday;
}