Java Code Examples for org.joda.time.DateTime.withDayOfWeek()

The following are Jave code examples for showing how to use withDayOfWeek() of the org.joda.time.DateTime class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: wulkanowy   File:   Source Code and License Vote up 6 votes
private String getDateOfCurrentMonday() {
    DateTime currentDate = new DateTime();

    if (currentDate.getDayOfWeek() == DateTimeConstants.SATURDAY) {
        currentDate = currentDate.plusDays(2);
    } else if (currentDate.getDayOfWeek() == DateTimeConstants.SUNDAY) {
        currentDate = currentDate.plusDays(1);
    } else {
        currentDate = currentDate.withDayOfWeek(DateTimeConstants.MONDAY);
    return currentDate.toString(DATE_PATTERN);