String dateString = "Wed, 09 Apr 2008 23:55:38 GMT";
SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz");
Date d = format.parse(dateString);
使用这个报错了,原因不深究,时间紧迫找个工具类转一下
RFC 2616 defines three different date formats that a conforming client must understand.
The Apache HttpClient provides a DateUtil that complies with the standard:
https://hc.apache.org/httpcomponents-client-4.5.x/current/httpclient/apidocs/org/apache/http/client/utils/DateUtils.html
https://github.com/apache/httpcomponents-client/blob/4.5.x/httpclient/src/main/java/org/apache/http/client/utils/DateUtils.java
Date date = DateUtils.parseDate( headerValue );
使用 org.apache.http.client.utils.DateUtils.parese
String dateString = "Wed, 09 Apr 2008 23:55:38 GMT";
Date d = DateUtils.parseDate(dateString);