其他日期之间的日期 java.time
Date between other Dates java.time
如何确定一个日期是否介于 Java 8 java.time
API 的另外两个日期之间?
LocalDate
class 有
isAfter(LocalDate other)
isBefore(LocalDate other)
isEqual(LocalDate other)
与其他日期进行比较的方法。这是一个例子:
LocalDate today = LocalDate.now();
LocalDate tomorrow = LocalDate.now().plusDays(1);
LocalDate yesterday = LocalDate.now().minusDays(1);
if(today.isAfter(yesterday) && today.isBefore(tomorrow))
System.out.println("Today is... today!");
如何确定一个日期是否介于 Java 8 java.time
API 的另外两个日期之间?
LocalDate
class 有
isAfter(LocalDate other)
isBefore(LocalDate other)
isEqual(LocalDate other)
与其他日期进行比较的方法。这是一个例子:
LocalDate today = LocalDate.now();
LocalDate tomorrow = LocalDate.now().plusDays(1);
LocalDate yesterday = LocalDate.now().minusDays(1);
if(today.isAfter(yesterday) && today.isBefore(tomorrow))
System.out.println("Today is... today!");