개발이야기/Java
String to Date, Date to String 형변환
ChamBrickAdmin
2019. 3. 22. 23:36
반응형
String to Date, Date to String 형변환
String to Date
String from = "2019-03-01 12:12:12"; SimpleDateFormat transFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date to = transFormat.parse(from); |
Date to String
Date from = new Date(); SimpleDateFormat transFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String to = transFormat.format(from); |
반응형