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