OffsetTime from(TemporalAccessor temporal) example
Description
OffsetTime from(TemporalAccessor temporal)
creates an instance of OffsetTime from a temporal object.
Syntax
from
has the following syntax.
public static OffsetTime from(TemporalAccessor temporal)
Example
The following example shows how to use from
.
import java.time.OffsetTime;
import java.time.ZonedDateTime;
/*from ww w. jav a 2 s. c om*/
public class Main {
public static void main(String[] args) {
OffsetTime m = OffsetTime.from(ZonedDateTime.now());
System.out.println(m);
}
}
The code above generates the following result.