LocalDateTime类用于表示日期和时间。
LocalDateTime类的常用方法:
1、 LocalDateTime.now():获取系统当前时间。
2、 LocalDateTime.of(int year,int month,int dayOfMonth
int hour,int minute,int second)
按指定日期和时间创建LocalDateTime对象。
3、getYear():返回日期中的年份。
4、getMonth():返回日期中的月份。
5、getDayOfMonth():返回月份中的日。
6、getHour():返回小时。
7、getMinute():返回分钟。
8、getSecond():返回秒。
【案例】用LocalDateTime获取当前日期和时间