From 217258891f8d90a0586a1d785b9ce72f7e226666 Mon Sep 17 00:00:00 2001 From: fwq <582742538@qq.com> Date: 星期一, 26 十二月 2022 17:38:34 +0800 Subject: [PATCH] 时间工具类 --- src/main/java/com/hx/util/DateUtil.java | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/hx/util/DateUtil.java b/src/main/java/com/hx/util/DateUtil.java index 18bc8ff..5f642aa 100644 --- a/src/main/java/com/hx/util/DateUtil.java +++ b/src/main/java/com/hx/util/DateUtil.java @@ -743,4 +743,15 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA); return sdf.format(calendar.getTime()); } + + /** + * 鑾峰彇鏃堕棿褰撴湀鍓╀綑澶╂暟 + * */ + public static Integer getMonthSurplus(Date date) { + Calendar month = Calendar.getInstance(); + month.setTime(new Date()); + month.set(Calendar.DATE, 1); + month.roll(Calendar.DATE, -1); + return month.getActualMaximum(Calendar.DATE) - Calendar.getInstance().get(Calendar.DAY_OF_MONTH); + } } -- Gitblit v1.8.0