优化代码

master
星期八 5 years ago
parent 20b0bba844
commit 0a3d972300
  1. 12
      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);
}
}

Loading…
Cancel
Save