Java Date Time - OffsetTime plusSeconds(long seconds) example








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

Syntax

plusSeconds has the following syntax.

public OffsetTime plusSeconds(long seconds)

Example

The following example shows how to use plusSeconds.

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

  }
}

The code above generates the following result.