Java Date Time - OffsetTime withMinute(int minute) example








OffsetTime withMinute(int minute) returns a copy of this OffsetTime with the minute-of-hour value altered.

Syntax

withMinute has the following syntax.

public OffsetTime withMinute(int minute)

Example

The following example shows how to use withMinute.

import java.time.OffsetTime;
/*from ww  w  .ja va2  s . c o m*/
public class Main {
  public static void main(String[] args) {
    OffsetTime m = OffsetTime.now();
    OffsetTime n = m.withMinute(34);
    System.out.println(n);

  }
}

The code above generates the following result.