Java Date Time - OffsetDateTime withMinute(int minute) example








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

Syntax

withMinute has the following syntax.

public OffsetDateTime withMinute(int minute)

Example

The following example shows how to use withMinute.

import java.time.OffsetDateTime;

public class Main {
  public static void main(String[] args) {
    OffsetDateTime o = OffsetDateTime.now();
    OffsetDateTime d =  o.withMinute(34);
    System.out.println(d);
  }
}

The code above generates the following result.