Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;

public class Main {

    public static void main(String[] args) {
        DateTimeFormatter dateFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM);
        System.out.println(dateFormatter.format(LocalDate.now())); // Current Local Date
        System.out.println(dateFormatter.parse("Jan 19, 2014").getClass().getName()); //java.time.format.Parsed
        System.out.println(dateFormatter.parse("Jan 19, 2014", LocalDate::from)); // Jan 19, 2014

    }
}