Example usage for org.joda.time LocalDate withMonthOfYear

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

Introduction

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

Prototype

public LocalDate withMonthOfYear(int monthOfYear) 

Source Link

Document

Returns a copy of this date with the month of year field updated.

Usage

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

License:Open Source License

@Override
protected LocalDate round(LocalDate date, boolean down) {
    if ((date.getMonthOfYear() == 1 || date.getMonthOfYear() == 7) && date.getDayOfMonth() == 1) {
        return date;
    }//from w  w w  .  j  av  a2s. co m

    date = date.withDayOfMonth(1);

    if (date.getMonthOfYear() < 7) {
        return down ? date.withMonthOfYear(1) : date.withMonthOfYear(7);
    } else {
        return down ? date.withMonthOfYear(7) : date.plusYears(1).withMonthOfYear(1);
    }
}