본문 바로가기
  • 오늘도 한걸음. 수고많았어요.^^
  • 조금씩 꾸준히 오래 가자.ㅎ
IT기술/JAVA

[JAVA] String to Date, Date to String 형변환

by 미노드 2018. 10. 28.

String to Date

1
2
3
4
5
String from = "2013-04-08 10:10:10";
 
SimpleDateFormat transFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
 

 

Date to String

1
2
3
4
5
Date from = new Date();
 
SimpleDateFormat transFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
String to = transFormat.format(from);
 

'IT기술 > JAVA' 카테고리의 다른 글

jsp 날짜 처리  (0) 2018.10.28
The type Date is ambiguous 에러  (0) 2018.10.28
execute / executeQuery / executeUpdate 차이  (0) 2018.10.07
파라미터 전송 - GET, POST 방식  (0) 2018.10.06
jsp 유효성 검사  (0) 2018.10.06