当前位置: 动力学知识库 > 问答 > 编程问答 >

Java Date String to date same format

问题描述:

2013-06-24 15:43:00.0 this is Sting

i want parse that to Date

but in same formate

if Month is Month Jan it should be 1 etc

网友答案:

Use the SimpleDateFormat like this:

String dateString = "2013.06.24 15:43:00";

SimpleDateFormat sdfToDate = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");

Date date1 = sdfToDate.parse(dateString);

System.out.println(sdfToDate.format(date1));
分享给朋友:
您可能感兴趣的文章:
随机阅读: