Java Date Time Java Java API
java.time.LocalTime
public LocalTime plusHours(long hoursToAdd)
Returns a copy of this LocalTime with the specified number of hours added.
package com.logicbig.example.localtime;import java.time.LocalTime;public class PlusHoursExample { public static void main (String... args) { LocalTime t = LocalTime.of(10, 2, 20); LocalTime t2 = t.plusHours(15); System.out.println(t2); t2 = t.plusHours(100); System.out.println(t2); t2 = t.plusHours(-15); System.out.println(t2); }}
01:02:2014:02:2019:02:20