@SuppressLint("SimpleDateFormat")
public static String toDateFormat(String v) {
String rtn = "";
if ( StringUtils.isNotEmpty(v) ) {
v = v.replaceAll("[^0-9]", "");
System.out.println(v);
SimpleDateFormat pm = new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat sm = new SimpleDateFormat("yyyy-MM-dd");
try {
Date vd = pm.parse(v);
rtn = sm.format(vd);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(rtn);
} else {
}
return rtn;
}
'java' 카테고리의 다른 글
kmeans (0) | 2019.01.29 |
---|---|
spring_sqlmap_selectkey (0) | 2019.01.29 |
java generic classes (0) | 2015.12.28 |
POJO to String by java reflection (0) | 2015.12.28 |
cors enable 가이드. (0) | 2015.10.08 |
댓글