From 7381f42dbec55951a0db5125d30886d1bdcad6a1 Mon Sep 17 00:00:00 2001 From: fhx <308050795@qq.com> Date: 星期五, 12 五月 2023 10:54:42 +0800 Subject: [PATCH] 1.日期工具新增方法 --- src/main/java/com/hx/util/DateUtil.java | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/hx/util/DateUtil.java b/src/main/java/com/hx/util/DateUtil.java index 361a86c..f54bcda 100644 --- a/src/main/java/com/hx/util/DateUtil.java +++ b/src/main/java/com/hx/util/DateUtil.java @@ -813,4 +813,33 @@ } return age; } + + /** + * 鑾峰彇鏌愬ぉ缁撴潫绉掓暟 + * @param startTime + * @return + */ + public long todayEndSecond(Date startTime) { + if(startTime == null){ + startTime = new Date(); + } + Date endTime = DateUtil.dayToEndDate(startTime); + //澶氬姞10绉� + return differSecond(startTime, endTime) + 10L; + } + + /** + * 璁$畻2涓疄闄呯浉宸鏁� + * @param startTime 寮�濮嬫椂闂� + * @param endTime 缁撴潫鏃堕棿 + * @return + */ + public long differSecond(Date startTime, Date endTime) { + if(startTime == null || endTime == null){ + return 0L; + } + long sTime = startTime.getTime(); + long eTime = endTime.getTime(); + return (eTime - sTime) / 1000L; + } } -- Gitblit v1.8.0