ChronoZonedDateTime from() method in Java with Examples
The from() method of ChronoZonedDateTime interface in Java method obtains an instance of ChronoZonedDateTime from a temporal object.
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
static ChronoZonedDateTime from(TemporalAccessor temporal)
Parameter: This method accepts a parameter temporal which specifies the temporal object to convert and not null.
Return Value: It returns the ChronoZonedDateTime and not null.
Exceptions: The function throws only DateTimeException which occurs if it is unable to convert it to a ChronoZonedDateTime.
Below programs illustrate the from() method of ChronoZonedDateTime in Java:
Note: The output will change on every run.