Java LocalDateTime parse String like June 21, 2014 12:01 AM
// Parse a date and time. import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; public class Main { public static void main(String args[]) { // Obtain a LocalDateTime object by parsing a date and time string. LocalDateTime curDateTime = LocalDateTime.parse("June 21, 2014 12:01 AM", DateTimeFormatter.ofPattern("MMMM d',' yyyy hh':'mm a")); // Now, display the parsed date and time. System.out.println(curDateTime.format(DateTimeFormatter.ofPattern("MMMM d',' yyyy h':'mm a"))); }// w w w . j a va 2 s . co m }