Example usage for java.time Month from

List of usage examples for java.time Month from

Introduction

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

Prototype

public static Month from(TemporalAccessor temporal) 

Source Link

Document

Obtains an instance of Month from a temporal object.

Usage

From source file:Main.java

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

    System.out.println(m.isSupported(ChronoField.MONTH_OF_YEAR));

}

From source file:Main.java

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

    System.out.println(m.getLong(ChronoField.MONTH_OF_YEAR));

}

From source file:Main.java

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

    System.out.println(m.range(ChronoField.MONTH_OF_YEAR));

}

From source file:Main.java

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

    System.out.println(m.getDisplayName(TextStyle.SHORT, Locale.UK));

}

From source file:Main.java

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

    Chronology n = m.query(TemporalQueries.chronology());
    System.out.println(n);//from www . jav  a 2s .  c  om

}

From source file:Main.java

public static void main(String[] args) {
    LocalDate localDate = LocalDate.of(2014, Month.AUGUST, 3);
    System.out.println(localDate);
    Month month1 = Month.from(localDate);
    System.out.println(month1);//w  ww. j  a  v a  2s . com

    Month month2 = Month.of(2);
    System.out.println(month2);

    Month month3 = month2.plus(2);
    System.out.println(month3);

    Month month4 = localDate.getMonth();
    System.out.println(month4);

    int monthIntValue = month2.getValue();
    System.out.println(monthIntValue);
}