Java tutorial
import java.time.Duration; import java.time.Instant; public class Main { public static void main(String[] args) { Duration d1 = Duration.ofSeconds(55); Duration d2 = Duration.ofSeconds(-17); Instant i1 = Instant.now(); Instant i4 = i1.plus(d1); Instant i5 = i1.minus(d2); Duration d3 = d1.plus(d2); System.out.println(d3); } }