ZonedDateTime of(LocalDate date, LocalTime time, ZoneId zone)
creates
an instance of ZonedDateTime from a local date and time.
of
has the following syntax.
public static ZonedDateTime of(LocalDate date, LocalTime time, ZoneId zone)
The following example shows how to use of
.
import java.time.LocalDate; import java.time.LocalTime; import java.time.ZoneId; import java.time.ZonedDateTime; // www . j a v a 2 s . com public class Main { public static void main(String[] args) { ZonedDateTime z = ZonedDateTime.of(LocalDate.now(),LocalTime.now(),ZoneId.systemDefault()); System.out.println(z); } }
The code above generates the following result.