Java Date Time - Month plus(long months) example








Month plus(long months) returns the month-of-year that is the specified number of quarters after this one.

Syntax

plus has the following syntax.

public Month plus(long months)

Example

The following example shows how to use plus.

import java.time.LocalDate;
import java.time.Month;
//ww w.j  a v  a  2 s. com
public class Main {
  public static void main(String[] args) {
    Month m = Month.from(LocalDate.now());
    
    System.out.println(m.plus(8));

  }
}

The code above generates the following result.