次のタイムスタンプを使用して解析したい文字列として保存していSimpleDateFormat
ますが、変換に問題があります。
xml ファイルから読み取ったタイムスタンプ:Tue Dec 31 09:29:08 PDT 2013
私のコード:
String timeStamp = innerNode.getTextContent(); //innerNode is a Node object that contains my TimeStamp from an xml file.
System.out.println(timeStamp);
SimpleDateFormat dateFormat = new SimpleDateFormat("E MMM dd HH:mm:ss z yyyy");
dateFormat.setTimeZone(TimeZone.getTimeZone("PDT"));
dateFormat.parse(timeStamp);
Date firstParsedDate = dateFormat.parse(timeStamp);
System.out.println(firstParsedDate);
それはうまくいきますが、私の結果は奇妙です。Tue Dec 31 09:29:08 PDT 2013
私の結果 を印刷する代わりに、次のようになります。Tue Dec 31 11:29:08 CDT 2013
何が間違っているのですか?ありがとう。