ZoneOffset adjustInto(Temporal temporal) example
Description
ZoneOffset adjustInto(Temporal temporal)
adjusts the specified temporal object to have the same offset as this object.
Syntax
adjustInto
has the following syntax.
public Temporal adjustInto(Temporal temporal)
Example
The following example shows how to use adjustInto
.
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.temporal.Temporal;
//w w w . j av a2s .c o m
public class Main {
public static void main(String[] args) {
ZoneOffset z = ZoneOffset.UTC;
Temporal t = z.adjustInto(ZonedDateTime.now());
System.out.println(t);
}
}
The code above generates the following result.