通过DateTimeFormatter.forPattern解析字符串

时间:2011-05-16 10:52:09

标签: java parsing datetime jodatime

我有一个字符串:

Sun May 15 00:00:00 IST 2011

现在,如果我想通过模式将其解析为joda DateTime:

EEE MMM dd 00:00:00 z yyyy

我得到了:

java.lang.IllegalArgumentException: Invalid format: "Sun May 15 00:00:00 IST 2011" is malformed at " 00:00:00 IST 2011"

但具有相同模式的SimpleDateFormat可以将该String解析为java.util.Date。我做错了什么?

谢谢和问候。

1 个答案:

答案 0 :(得分:2)

JODA不支持解析时区名称。

来自API documentation

区域名称:无法解析时区名称('z')。