TimeZone.setDefault(TimeZone.getTimeZone("CST"));try{ String d = "Wed Jan 15 00:00:00 CST 2014"; SimpleDateFormat formatter = new SimpleDateFormat("E MMM dd hh:mm:ss z yyyy"); Date date = formatter.parse(d); System.out.println(date);
SimpleDateFormat format = new SimpleDate(Format("yyyy-MM-dd HH:mm:ss"); String dd =format.format(date ); Date ddd; ddd = format.parse(dd); System.out.println("dd>>>> "+dd); System.out.println("ddd>>> "+format.format(ddd));
} catch(Exception ex) {ex.printStackTrace();}
使用simpleDateFormat就可以了,不过需要注意,需要把local设成英文才能装换。
String date = "Wed Jan 15 00:00:00 CST 2014";
Date dd = new Date(date);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println(sdf.format(dd));