Java Date Time Java Java API
java.time.ZoneOffset
public Temporal adjustInto(Temporal temporal)
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); }}
-07:002025-10-28T20:46:21.832+08:00 > 2025-10-28T20:46:21.832-07:00