|
|
|
@ -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); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|