Example usage for org.joda.time LocalDate withDayOfWeek

List of usage examples for org.joda.time LocalDate withDayOfWeek

Introduction

In this page you can find the example usage for org.joda.time LocalDate withDayOfWeek.

Prototype

public LocalDate withDayOfWeek(int dayOfWeek) 

Source Link

Document

Returns a copy of this date with the day of week field updated.

Usage

From source file:org.zkoss.ganttz.timetracker.zoom.DetailFiveTimeTrackerState.java

License:Open Source License

@Override
protected LocalDate round(LocalDate date, boolean down) {
    int dayOfWeek = date.getDayOfWeek();

    if (dayOfWeek == 1) {
        return date;
    }//from ww  w. j a  va2 s . c om

    return down ? date.withDayOfWeek(1) : date.withDayOfWeek(1).plusWeeks(1);
}

From source file:org.zkoss.ganttz.timetracker.zoom.DetailSixTimeTrackerState.java

License:Open Source License

@Override
protected LocalDate round(LocalDate date, boolean down) {
    int dayOfWeek = date.getDayOfWeek();
    if (dayOfWeek == 1) {
        return date;
    }// w w w  .  j  av  a 2 s  .  c o m
    return down ? date.withDayOfWeek(1) : date.withDayOfWeek(1).plusWeeks(1);
}