Tip) [SimpleDateFormat] String ↔ 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 데이터로 리턴된다.
'개발 이야기 > Java' 카테고리의 다른 글
02. OOP(Object Oriented Programming) (0) | 2018.07.11 |
---|---|
Try ~Catch 문과 Exception처리 (0) | 2018.06.28 |
Tip) eclipse에서 workspace 변경하는 방법 (0) | 2016.06.23 |
Tip) Eclipse 자주 쓰는 단축키(18.07.07) (0) | 2016.01.25 |
01. Java의 특징 (0) | 2015.11.28 |