Returns a copy of this ZonedDateTime with a different time-zone. The returned instance represents the same 'instant' (same moment in time) as the original ZonedDateTime instance.

package com.logicbig.example.zoneddatetime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
public class WithZoneSameInstantExample {
public static void main(String... args) {
ZonedDateTime d = ZonedDateTime.of(2017, 2, 12, 20, 33, 23, 2000,
ZoneId.systemDefault());
System.out.println(d);
ZonedDateTime d2 = d.withZoneSameInstant(ZoneId.of("Pacific/Fiji"));
System.out.println(d2);
}
}
Output
2017-02-12T20:33:23.000002-06:00[America/Chicago]
2017-02-13T14:33:23.000002+12:00[Pacific/Fiji]