How to parse Date from HTTP Last-Modified header?

前端 未结 5 1986
孤街浪徒
孤街浪徒 2020-12-08 00:02

HTTP Last-Modified header contains date in following format (example):
Wed, 09 Apr 2008 23:55:38 GMT
What is the easiest way to parse java.util.

5条回答
  •  感情败类
    2020-12-08 00:48

    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.3.x/httpclient/apidocs/org/apache/http/client/utils/DateUtils.html

    https://apache.googlesource.com/httpclient/+/4.3.x/httpclient/src/main/java/org/apache/http/client/utils/DateUtils.java

    Date date = DateUtils.parseDate( headerValue );

提交回复
热议问题