본문 바로가기
→ 개발/JAVA

[JAVA] Date → String, String → Date

by 벅스쭌 2020. 6. 19.
반응형

Date → String

SimpleDateFormat dateType = new SimpleDateFormat("yyyyMMddHHmmss");
String testDateString = dateType.format(new Date());

String → Date

SimpleDateFormat dateType = new SimpleDateFormat("yyyyMMddHHmmss");
String testDateString = dateType.format(new Date());//Result : 20200619144500
Date testDate = dateType.parse(dateString);

 

반응형