Example usage for java.time ZonedDateTime with

List of usage examples for java.time ZonedDateTime with

Introduction

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

Prototype

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

Source Link

Document

Returns a copy of this date-time with the specified field set to a new value.

Usage

From source file:Main.java

public static void main(String[] args) {
    ZonedDateTime dateTime = ZonedDateTime.now();
    dateTime = dateTime.with(ChronoField.YEAR, 2000);
    System.out.println(dateTime);
}