From 0a3d9723006058975cded3e65ef7ff263e47a218 Mon Sep 17 00:00:00 2001 From: qi_liang Date: Mon, 20 Jan 2020 22:32:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/panda/code/uitl/DateUtil.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/panda-code/src/main/java/org/panda/code/uitl/DateUtil.java b/panda-code/src/main/java/org/panda/code/uitl/DateUtil.java index f39ed7f..f877304 100644 --- a/panda-code/src/main/java/org/panda/code/uitl/DateUtil.java +++ b/panda-code/src/main/java/org/panda/code/uitl/DateUtil.java @@ -38,15 +38,14 @@ public class DateUtil { * @return */ public static String getDateToStr(Date date,String pattern){ - String str=null; - if (StringUtil.isNull(pattern)){ + if (StringUtil.isEmpty(pattern)){ pattern = DEFAULT_PATTERN; } SimpleDateFormat sdf=new SimpleDateFormat(pattern); if (date == null){ throw new NullPointerException("====== date 对象为空 null======"); } - str=sdf.format(date); + String str=sdf.format(date); return str; } @@ -58,7 +57,7 @@ public class DateUtil { * @throws ParseException */ public static Date strToDate(String strDate,String pattern) throws ParseException { - if (StringUtil.isNull(pattern)){ + if (StringUtil.isEmpty(pattern)){ pattern = DEFAULT_PATTERN; } @@ -95,11 +94,6 @@ public class DateUtil { } - public static void main(String[] args) { - String str = dataFormat(System.currentTimeMillis()); - LOGGER.debug(str); - - } }