Created: 2023-08-30 18:23
Status: #concept
Subject: Programming
Tags: Java Java Class Java Package

java.time.LocalDate

It exposes the LocalDate.now() static Method to return a LocalDate object with the date during the time the code executes.

It does not store the time.

import java.time.LocalDate;

public class Example {

    public static void main(String[] args) {

        LocalDate now = LocalDate.now();
        int year = now.getYear();
        int month = now.getMonthValue();
        int day = now.getDayOfMonth();

        System.out.println("today is  " + day + "." + month + "." + year);
    }
}

Instance Methods

References