Java Date Time Java Java API
java.time.LocalDateTime
public LocalDateTime plusHours(long hours)
Returns a copy of this LocalDateTime with the specified number of hours added.
package com.logicbig.example.localdatetime;import java.time.LocalDateTime;public class PlusHoursExample { public static void main (String... args) { LocalDateTime d = LocalDateTime.of(2016, 1, 1, 22, 20); LocalDateTime d2 = d.plusHours(3000); System.out.println(d2); d2 = d.plusHours(-3000); System.out.println(d2); }}
2016-05-05T22:202015-08-29T22:20