このジレンマには、このサイトでいくつかの解決策がありましたが、私はJoda Timeをインストールしていませんが、なぜこれが失敗したのかはまだ分かりません。DateFormat.parse()を使用して解析できない日付
解決策の1つとしてコロンを削除しようとしましたが、それは役に立たなかったです。
currentNode.getProperty("jcr:created").getString()
= 2013-03-07T11:57:08.596から05:00
が、私はこのエラーを取得する:java.text.ParseException:解析できない日:「2013-03-07T11:57:08.596を-05:Z
としてフォーマットさ00"
<%@page import="
java.util.Date,
java.text.SimpleDateFormat,
java.text.DateFormat"
%>
<%
DateFormat outputFormat = new SimpleDateFormat("MMMM dd, yyyy");
DateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
String currentDate = currentNode.getProperty("jcr:created").getString();
Date date = inputFormat.parse(currentDate); // <-- Failing here
String currentDateString = outputFormat.format(date);
%>
関連:http://stackoverflow.com/a/2202300/738746 –