Java DateTimeFormatter:带GMT日期的DateTimeParseException

Sim*_*mon 4 java exception java-8

我想解析像GMT-日期Wed, 21 Oct 2016 07:28:00 GMTDateTimeFormatterInstant.为了创建模式,我使用了官方文档:DateTimeFormatter

我的代码到目前为止:

String date = "Wed, 21 Oct 2016 07:28:00 GMT";

DateTimeFormatter gmtFormat = DateTimeFormatter.ofPattern("EEE' dd LLL yyyy HH:mm:ss '''");
TemporalAccessor parsed = gmtFormat.parse(date);
Instant a = Instant.from(parsed);

System.out.println(a);
Run Code Online (Sandbox Code Playgroud)

但每次我有这个错误:

Exception in thread "main" java.time.format.DateTimeParseException: Text 'Wed, 21 Oct 2016 07:28:00 GMT' could not be parsed at index 0
at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1949)
at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1777)
Run Code Online (Sandbox Code Playgroud)

在索引0Wed,我使用的EEE代表day-of-week定义,也有代表:Tue; Tuesday; T.

我也尝试过低,大写但不成功.怎么了?我忽略了什么吗?

wat*_*hme 5

它适用于代码

String date = "Fri, 21 Oct 2016 07:28:00 GMT";

DateTimeFormatter gmtFormat = DateTimeFormatter.RFC_1123_DATE_TIME;
TemporalAccessor parsed = gmtFormat.parse(date);
Instant a = Instant.from(parsed);

System.out.println(a);
Run Code Online (Sandbox Code Playgroud)

但你必须改变一天,否则它不适合给定的日期.