Java Date Time - OffsetTime with(TemporalAdjuster adjuster) example








OffsetTime with(TemporalAdjuster adjuster) returns an adjusted copy of this time.

Syntax

with has the following syntax.

public OffsetTime with(TemporalAdjuster adjuster)

Example

The following example shows how to use with.

import java.time.OffsetTime;
/* w w  w  .  jav a 2  s. c  o m*/
public class Main {
  public static void main(String[] args) {
    OffsetTime m = OffsetTime.now();
    OffsetTime n = m.with(OffsetTime.now());
    System.out.println(n);

  }
}

The code above generates the following result.