Parse 'Jan 20 2014' to LocalDate
Description
The following code shows how to parse 'Jan 20 2014' to LocalDate.
Example
// www . j av a2s .c o m
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
public class Main {
public static void main(String[] args) {
String input = "Jan 20 2014";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMM d yyyy");
LocalDate date = LocalDate.parse(input, formatter);
System.out.printf("%s%n", date);
}
}
The code above generates the following result.