Java Date Time Java Java API
java.time.LocalTime
public LocalTime plusSeconds(long secondsToAdd)
Returns a copy of this LocalTime with the specified number of seconds added.
package com.logicbig.example.localtime;import java.time.LocalTime;public class PlusSecondsExample { public static void main (String... args) { LocalTime t = LocalTime.of(10, 2, 20); LocalTime t2 = t.plusSeconds(25); System.out.println(t2); t2 = t.plusSeconds(-25); System.out.println(t2); t2 = t.plusSeconds(500); System.out.println(t2); }}
10:02:4510:01:5510:10:40