Example usage for java.time Month minus

List of usage examples for java.time Month minus

Introduction

In this page you can find the example usage for java.time Month minus.

Prototype

public Month minus(long months) 

Source Link

Document

Returns the month-of-year that is the specified number of months before this one.

Usage

From source file:Main.java

public static void main(String[] args) {
    Month m = Month.from(LocalDate.now());

    System.out.println(m.minus(8));

}

From source file:com.github.drbookings.LocalDates.java

public static boolean isLastThreeMonths(final LocalDate date) {
    final Month month = LocalDate.now().getMonth().minus(1);
    if (date.getMonth().equals(month) && (date.getYear() == LocalDate.now().getYear()
            || date.getYear() == LocalDate.now().getYear() - 1)) {
        return true;
    }//from w ww.  j a  v a  2  s.c om
    if (date.getMonth().equals(month.minus(1)) && (date.getYear() == LocalDate.now().getYear()
            || date.getYear() == LocalDate.now().getYear() - 1)) {
        return true;
    }
    return date.getMonth().equals(month.minus(2))
            && (date.getYear() == LocalDate.now().getYear() || date.getYear() == LocalDate.now().getYear() - 1);
}