Commit 62b86bda5517df11734c60d57a6f293be6fbb5a4
1 parent
54378aee
增加max函数
Showing
1 changed file
with
10 additions
and
0 deletions
src/main/java/cn/iocoder/dashboard/util/date/DateUtils.java
| @@ -59,4 +59,14 @@ public class DateUtils { | @@ -59,4 +59,14 @@ public class DateUtils { | ||
| 59 | return calendar.getTime(); | 59 | return calendar.getTime(); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | + public static Date max(Date a, Date b) { | ||
| 63 | + if (a == null) { | ||
| 64 | + return b; | ||
| 65 | + } | ||
| 66 | + if (b == null) { | ||
| 67 | + return a; | ||
| 68 | + } | ||
| 69 | + return a.compareTo(b) > 0 ? a : b; | ||
| 70 | + } | ||
| 71 | + | ||
| 62 | } | 72 | } |