lansefengmeng
Date d1 = new Date(System.currentTimeMillis()-1000);
Date d2 = new Date(System.currentTimeMillis());
System.out.println(d1.compareTo(d2));

  java util date 自带了compareTo 功能,可直接比较大小。

  前者大于后者 返回大于0 反之小于0。
  

  LocatDateTime 同理

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-05-18
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-30
  • 2021-05-21
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案