mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
!693 比较两个 LocalDateTime 是否为同一天
Merge pull request !693 from HsinDumas/v5-dev
This commit is contained in:
commit
7dd7a35edf
@ -571,4 +571,16 @@ public class LocalDateTimeUtil {
|
||||
public static int weekOfYear(TemporalAccessor date){
|
||||
return TemporalAccessorUtil.get(date, WeekFields.ISO.weekOfYear());
|
||||
}
|
||||
|
||||
/**
|
||||
* 比较两个日期是否为同一天
|
||||
*
|
||||
* @param date1 日期1
|
||||
* @param date2 日期2
|
||||
* @return 是否为同一天
|
||||
* @since 5.8.5
|
||||
*/
|
||||
public static boolean isSameDay(final LocalDateTime date1, final LocalDateTime date2) {
|
||||
return date1 != null && date2 != null && date1.toLocalDate().isEqual(date2.toLocalDate());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user