We would like to know how to parse String '20.01.2014' as custom format dd.MM.yyyy.
import java.time.LocalDate; import java.time.format.DateTimeFormatter; //from w w w. j a va 2 s . com public class Main { public static void main(String[] args) { LocalDate fromCustomPattern = LocalDate.parse("20.01.2014", DateTimeFormatter.ofPattern("dd.MM.yyyy")); System.out.println(fromCustomPattern); } }
The code above generates the following result.