Java LocalDate now() Method
Example
Display the current date:
import java.time.LocalDate;
public class Main {
public static void main(String[] args) {
LocalDate myObj = LocalDate.now();
System.out.println(myObj);
}
}
Note: The output is different each time you run the program.
Definition and Usage
The now() method returns the current date, read from the system clock (the clock of the computer that runs the program).
When you print the date, it is shown as year-month-day, for example 2026-11-06.
Tip: To create a fixed date instead, use the of() method.
Syntax
One of the following:
public static LocalDate now()
public static LocalDate now(ZoneId zone)
public static LocalDate now(Clock clock)
Parameter Values
| Parameter | Description |
|---|---|
| zone | Optional. The time zone (the local time of a region) to use, for example ZoneId.of("UTC"). If it is left out, the default time zone of the computer is used. |
| clock | Optional. The clock to read from. It is mostly used to test programs with a fixed date and time. |
Technical Details
| Returns: | The current date, as a LocalDate object. |
|---|
Related Pages
❮ Date and Time Methods