From e1d72f68c0a872d44712bd2b61cce701233b4973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E7=90=A6=E6=B6=9B?= Date: Thu, 9 Mar 2023 17:34:35 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix=20sonar=E3=80=91DateUtils=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/jero/common/util/DateUtils.java | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/util/DateUtils.java b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/util/DateUtils.java index 99e79cb2..7a415249 100644 --- a/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/util/DateUtils.java +++ b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/util/DateUtils.java @@ -137,12 +137,12 @@ public class DateUtils extends PropertyEditorSupport { /** * 日期转换为字符串 * - * @param date_sdf 日期格式 + * @param dateSdf 日期格式 * @return 字符串 */ - public static String date2Str(SimpleDateFormat date_sdf) { + public static String date2Str(SimpleDateFormat dateSdf) { Date date = getDate(); - return date_sdf.format(date); + return dateSdf.format(date); } /** @@ -154,27 +154,27 @@ public class DateUtils extends PropertyEditorSupport { */ public static String dateformat(String date, String format) { SimpleDateFormat sformat = new SimpleDateFormat(format); - Date _date = null; + Date dateNew = null; try { - _date = sformat.parse(date); + dateNew = sformat.parse(date); } catch (ParseException e) { e.printStackTrace(); } - return sformat.format(_date); + return sformat.format(dateNew); } /** * 日期转换为字符串 * * @param date 日期 - * @param date_sdf 日期格式 + * @param dateSdf 日期格式 * @return 字符串 */ - public static String date2Str(Date date, SimpleDateFormat date_sdf) { + public static String date2Str(Date date, SimpleDateFormat dateSdf) { if (null == date) { return null; } - return date_sdf.format(date); + return dateSdf.format(date); } /** @@ -251,8 +251,7 @@ public class DateUtils extends PropertyEditorSupport { Date dt = new Date(); DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String nowTime = df.format(dt); - java.sql.Timestamp buydate = java.sql.Timestamp.valueOf(nowTime); - return buydate; + return java.sql.Timestamp.valueOf(nowTime); } // ////////////////////////////////////////////////////////////////////////////