代码:
package cn.tedu.time;

import java.time.LocalDate;
import java.time.temporal.ChronoUnit;

public class LocalDateDemo {
public static void main(String[] args) {
//获取当前的日期
LocalDate l=LocalDate.now();
//LocalTime—操作时间
//LocalDateTime—操作日期和时间
//只有日期
//任意操作日期
System.out.println(l.plus(2,ChronoUnit.CENTURIES));
}
}
输出:
2219-12-26

代码图:
LocalDate.now()------获取当前的日期

相关文章:

  • 2022-02-25
  • 2021-12-07
  • 2022-02-02
  • 2021-07-10
  • 2021-11-28
  • 2021-12-07
  • 2022-01-04
  • 2022-02-08
猜你喜欢
  • 2022-01-11
  • 2021-11-30
  • 2021-12-18
  • 2021-12-23
  • 2021-10-19
  • 2021-06-01
相关资源
相似解决方案