JAVA code

Date

paulaner80 2014. 10. 4. 12:58
반응형

1. Date와 String간 형변환


String to Date


String date = "2014-10-04 13:00:30";

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

Date string = sdf.parse(date);




Date to String


Date date = new Date();

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

String string = sdf.format(date);

'JAVA code' 카테고리의 다른 글

Math.ceil, Math.floor,Math.round  (0) 2016.04.11
test  (0) 2014.10.02