Example usage for java.time YearMonth with

List of usage examples for java.time YearMonth with

Introduction

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

Prototype

@Override
public YearMonth with(TemporalField field, long newValue) 

Source Link

Document

Returns a copy of this year-month with the specified field set to a new value.

Usage

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.  jav  a 2  s  .co m

}