Example usage for java.time OffsetDateTime with

List of usage examples for java.time OffsetDateTime with

Introduction

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

Prototype

@Override
public OffsetDateTime 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) {
    OffsetDateTime o = OffsetDateTime.now();
    OffsetDateTime d = o.with(ChronoField.YEAR, 2010);
    System.out.println(d);//w  w w .java 2  s  .  c om
}