//pattern使用中,小时使用小写的hh程序能会报错
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter dateTimeFormatter3 = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss");
String format3 = now.format(dateTimeFormatter3);
System.out.println(format3);
System.out.println(LocalDateTime.parse(format3, dateTimeFormatter3));
//pattern使用中,小时使用大写的HH程序能正常解析
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter dateTimeFormatter3 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String format3 = now.format(dateTimeFormatter3);
System.out.println(format3);
System.out.println(LocalDateTime.parse(format3, dateTimeFormatter3));
疑似,hh和HH兼容性未做好。(jdk1.8)



