Java Date Time - LocalTime minus(TemporalAmount amountToSubtract) example








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

Syntax

minus has the following syntax.

public LocalTime minus(TemporalAmount amountToSubtract)

Example

The following example shows how to use minus.

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