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 = transFormat.parse(from);
|
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 |