Adjusts the specified temporal object to have the same offset as this ZoneOffsetObject. The returned Temporal is of the same type as of the input temporal type.
package com.logicbig.example.zoneoffset;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.time.temporal.Temporal;
public class AdjustIntoExample {
public static void main(String... args) {
ZoneOffset z = ZoneOffset.ofHours(-7);
System.out.println(z);
OffsetDateTime d = OffsetDateTime.now();
Temporal t = z.adjustInto(d);
System.out.printf("%s > %s%n", d, t);
}
}
Output
-07:00
2017-05-01T15:50:47.348-05:00 > 2017-05-01T15:50:47.348-07:00