본문 바로가기
Programming/Java

자바에서 String to Timestamp

by Chan_찬 2016. 4. 12.
728x90



private Timestamp stringToTimestamp(String date){
Calendar cal;
SimpleDateFormat sd = new SimpleDateFormat("yyyyMMddHHmmss");
try {
sd.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
cal = sd.getCalendar();
return new Timestamp(cal.getTime().getTime());
}


728x90
728x90
Buy me a coffeeBuy me a coffee

댓글