Example usage for java.time.temporal ChronoField YEAR

List of usage examples for java.time.temporal ChronoField YEAR

Introduction

In this page you can find the example usage for java.time.temporal ChronoField YEAR.

Prototype

ChronoField YEAR

To view the source code for java.time.temporal ChronoField YEAR.

Click Source Link

Document

The proleptic year, such as 2012.

Usage

From source file:Main.java

public static void main(String[] args) {
    Year y = Year.of(2014);
    Year l = y.with(ChronoField.YEAR, 2013);
    System.out.println(l);

}

From source file:Main.java

public static void main(String[] args) {
    Year y = Year.of(2014);

    System.out.println(y.get(ChronoField.YEAR));

}

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);//from   w ww  .  ja va2s  .  c  o  m

}

From source file:Main.java

public static void main(String[] args) {
    Year y = Year.of(2014);

    System.out.println(y.range(ChronoField.YEAR));

}

From source file:Main.java

public static void main(String[] args) {
    Year y = Year.of(2014);

    System.out.println(y.getLong(ChronoField.YEAR));

}

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);//w w  w  .  j av a2 s . com

}

From source file:Main.java

public static void main(String[] args) {
    YearMonth y = YearMonth.now();
    YearMonth s = y.with(ChronoField.YEAR, 2013);
    System.out.println(s);/*from w w  w. j ava2s .  c  o  m*/

}

From source file:Main.java

public static void main(String[] args) {
    Year y = Year.of(2014);

    System.out.println(y.isSupported(ChronoField.YEAR));

}

From source file:Main.java

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

}

From source file:Main.java

public static void main(String[] args) {
    LocalDate a = LocalDate.of(2014, 6, 30);
    LocalDate b = a.with(ChronoField.YEAR, 2015);
    System.out.println(b);/*w ww.ja v a  2 s.  c  o m*/
}