package com.logicbig.example.zoneddatetime;
import java.time.ZonedDateTime;
public class PlusHoursExample {
public static void main(String... args) {
ZonedDateTime d = ZonedDateTime.now();
System.out.println(d);
ZonedDateTime d2 = d.plusHours(10);
System.out.println(d2);
ZonedDateTime d3 = d.plusHours(1000000);
System.out.println(d3);
ZonedDateTime d4 = d.plusHours(-1000000);
System.out.println(d4);
}
}
Output
2017-05-01T16:01:00.459-05:00[America/Chicago]
2017-05-02T02:01:00.459-05:00[America/Chicago]
2131-05-31T08:01:00.459-05:00[America/Chicago]
1903-04-03T23:01:00.459-06:00[America/Chicago]