# LocalDate from() method in Java

Java 8Object Oriented ProgrammingProgramming

An instance of a LocalDate object can be obtained from a Temporal object using the from() method in the LocalDate class in Java. This method requires a single parameter i.e. the Temporal object and it returns the LocalDate object that is obtained from the Temporal object.

A program that demonstrates this is given as follows −

## Example

Live Demo

import java.time.*;
public class Main {
public static void main(String[] args) {
LocalDate ld = LocalDate.from(ZonedDateTime.now());
System.out.println("The LocalDate is: " + ld);
}
}

## Output

The LocalDate is: 2019-02-16

Now let us understand the above program.

The instance of the LocalDate object is obtained from the Temporal object using the from() method and then it is displayed. A code snippet that demonstrates this is as follows −

LocalDate ld = LocalDate.from(ZonedDateTime.now());
System.out.println("The LocalDate is: " + ld);
Published on 27-Mar-2019 09:37:26