Java Date Time - OffsetTime minus(TemporalAmount amountToSubtract) example








OffsetTime minus(TemporalAmount amountToSubtract) returns a copy of this time with the specified amount subtracted.

Syntax

minus has the following syntax.

public OffsetTime minus(TemporalAmount amountToSubtract)

Example

The following example shows how to use minus.

import java.time.OffsetTime;
import java.time.Period;
/*from   w  w  w. j a v a  2  s.  c  o m*/
public class Main {
  public static void main(String[] args) {
    OffsetTime m = OffsetTime.now();
    OffsetTime n = m.minus(Period.ofDays(12));
    System.out.println(n);

  }
}