java日期格式转换,在线
java日期格式转换,在线求助
Sun Apr 07 11:12:34 CST 2013
如何把以上这种字符串日期转化成时间类型。
------解决方案--------------------
Sun Apr 07 11:12:34 CST 2013
如何把以上这种字符串日期转化成时间类型。
java
时间格式转换
------解决方案--------------------
public static void main(String[] args) throws ParseException {
String s="Sun Apr 07 11:12:34 CST 2013";
DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss 'CST' yyyy",Locale.US);
DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println(sdf.format(df.parse(s)));
}