Twitter date unparseable?

后端 未结 7 2067
误落风尘
误落风尘 2020-12-11 15:52

I want to convert the date string in a Twitter response to a Date object, but I always get a ParseException and I cannot see the error!?!

Input string: Thu Dec 23 18

7条回答
  •  南笙
    南笙 (楼主)
    2020-12-11 16:18

    SimpleDateFormat is not thread safe. "EEE MMM dd HH:mm:ss ZZZZZ yyyy" was working in our application, but failing in a small percentage of cases. We finally realized that the issue was coming from multiple threads using the same instance of SimpleDateFormat.

    Here is one workaround: http://www.codefutures.com/weblog/andygrove/2007/10/simpledateformat-and-thread-safety.html

提交回复
热议问题