Java Date Time - OffsetTime minusHours(long hours) example








OffsetTime minusHours(long hours) returns a copy of this OffsetTime with the specified period in hours subtracted.

Syntax

minusHours has the following syntax.

public OffsetTime minusHours(long hours)

Example

The following example shows how to use minusHours.

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

  }
}

The code above generates the following result.