Java8新特性 第13课-localDateTime类

来源:互联网 发布:海贼王里的熊猫人 知乎 编辑:程序博客网 时间:2024/09/21 09:01

LocalDateTime类用于表示日期和时间。

LocalDateTime类的常用方法:

1LocalDateTime.now():获取系统当前时间。

2LocalDateTime.of(intyear,intmonth,intdayOfMonth

  inthour,intminute,int second)

  按指定日期和时间创建LocalDateTime对象。

3getYear():返回日期中的年份。

4getMonth():返回日期中的月份。

5getDayOfMonth():返回月份中的日。

6getHour():返回小时。

7getMinute():返回分钟。

8getSecond():返回秒。

案例LocalDateTime获取当前日期和时间



0 0
原创粉丝点击