最后一个是LocalDateTime,也是Java中最常用的Date / Time类,代表前两个累的组合 - 即日期和时间的值:
LocalDateTime dateTime = LocalDateTime.now(); // gets the current date and time
format的方式也一样
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss");
System.out.println(dateTime.format(formatter));
得到的日期结果类似于:
25-11-2018 00:57:20