LocalDate startDate = new LocalDate(2014,1,2);
LocalDateTime startDateTime = new LocalDateTime(2014,2,14,0);
我需要比较startDate和startDateTime相关的日期,如下所示:@H_404_5@
// boolean equalDates = startDate.isequal(startDateTime.getDate());
是否有可能做到这一点?@H_404_5@
如果您只想比较日期部分,可以这样做:
LocalDate startDate = new LocalDate(2014,2);
LocalDateTime startDateTime = new LocalDateTime(2014,0);
LocalDate forCompare = startDateTime.toLocalDate();
System.out.println("equal dates: " + forCompare.equals(startDate));
// equal dates: true
docs@H_404_5@
原文链接:https://www.f2er.com/java/127401.html