Java Date Time - OffsetTime minusSeconds(long seconds) example








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

Syntax

minusSeconds has the following syntax.

public OffsetTime minusSeconds(long seconds)

Example

The following example shows how to use minusSeconds.

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

  }
}

The code above generates the following result.