您好,我有日期在這種格式2013-10-31T19:00:00Z
現在我想顯示此日期爲yyyy/mm/dd
這format.i已經使用這個代碼,但它給我的異常好心幫我我想字符串解析成Java日期對象
String startDateString = "2013-10-31T19:00:00Z";
DateFormat df = new SimpleDateFormat("yyyy/mm/dd");
Date startDate;
try {
startDate = df.parse(startDateString);
String newDateString = df.format(startDate);
System.out.println("Date is "+newDateString);
} catch (ParseException e) {
e.printStackTrace();
}
向我們展示了異常。 –
http://stackoverflow.com/questions/2201925/converting-iso8601-compliant-string-to-java-util-date – chrylis