자바 날짜<--> 문자열 변환 (Java Date)

String → Date 타입

DateFormat sdFormat = new SimpleDateFormat("yyyyMMdd");
Date tempDate = sdFormat.parse("20100222");

주의할 점.. " " 내부에 들어가는 내용대로 String 데이터가 입력되어 있어야 파싱이 된다.

Date → String 타입

DateFormat sdFormat = new SimpleDateFormat("yyyyMMdd");
Date nowDate = new Date();
String tempDate = sdFormat.format(nowDate);

주의할 점.. " " 내부에 들어가는 내용대로 포멧되어 String 데이터로 리턴된다.