Java program to print present date

Views: 121   

Following program shows you how to print present date.
We can get present date using LocalDate.now() in java.

import java.time.LocalDate;

public class Basic16 {

    public static void main(String[] args) {

        LocalDate presentDate = LocalDate.now();

        System.out.println("Present Date is: " + presentDate);

    }

}

Output:

Present Date is: 2018-03-19
On By