Example usage for java.time YearMonth now

List of usage examples for java.time YearMonth now

Introduction

In this page you can find the example usage for java.time YearMonth now.

Prototype

public static YearMonth now() 

Source Link

Document

Obtains the current year-month from the system clock in the default time-zone.

Usage

From source file:Main.java

public static void main(String[] args) {
    YearMonth y = YearMonth.now();
    Month m = y.getMonth();
    System.out.println(m);

}

From source file:Main.java

public static void main(String[] args) {
    YearMonth y = YearMonth.now();
    YearMonth s = y.plus(Period.ofYears(3));
    System.out.println(s);//from  w ww.  j a  va2 s. c o m

}

From source file:Main.java

public static void main(String[] args) {
    YearMonth y = YearMonth.now();
    YearMonth s = y.minus(Period.ofYears(3));
    System.out.println(s);//from www .  ja  v  a  2s .  c  o  m

}

From source file:Main.java

public static void main(String[] args) {
    YearMonth y = YearMonth.now();
    LocalDate l = y.atDay(2);
    System.out.println(l);

}

From source file:Main.java

public static void main(String[] args) {
    YearMonth y = YearMonth.now();
    LocalDate l = y.atEndOfMonth();
    System.out.println(l);

}

From source file:Main.java

public static void main(String[] args) {
    YearMonth y = YearMonth.now();
    boolean m = y.isSupported(ChronoUnit.YEARS);
    System.out.println(m);/*from w  w  w  . j  a v  a  2  s .  c om*/

}

From source file:Main.java

public static void main(String[] args) {
    YearMonth y = YearMonth.now();
    YearMonth s = y.minus(12, ChronoUnit.YEARS);
    System.out.println(s);//w w  w .  j a  v a 2  s .  co  m

}

From source file:Main.java

public static void main(String[] args) {
    YearMonth y = YearMonth.now();
    YearMonth s = y.plus(3, ChronoUnit.YEARS);
    System.out.println(s);/*from  w w  w .  j  av  a2 s  . c  o m*/

}

From source file:Main.java

public static void main(String[] args) {
    YearMonth y = YearMonth.now();
    long m = y.get(ChronoField.YEAR);
    System.out.println(m);// www  .  ja  v a  2s .  c o m

}

From source file:Main.java

public static void main(String[] args) {
    YearMonth y = YearMonth.now();
    long m = y.getLong(ChronoField.YEAR);
    System.out.println(m);/*from ww  w  .ja  va 2  s .c o  m*/

}