package com.logicbig.example.offsetdatetime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
public class PlusHoursExample {
public static void main(String... args) {
OffsetDateTime d = OffsetDateTime.of(2015, 11, 15,
18, 20, 30, 100, ZoneOffset.ofHours(-6));
OffsetDateTime d2 = d.plusHours(3000);
System.out.println(d2);
OffsetDateTime d3 = d.plusHours(-3000);
System.out.println(d3);
}
}
Output
2016-03-19T18:20:30.000000100-06:00
2015-07-13T18:20:30.000000100-06:00