Timezone for Expires and Last-Modified HTTP Headers
This is a question reg开发者_运维问答arding the timezone specified in the Expires and Last-Modified HTTP headers.
In most of the examples I have seen, I always see GMT as the specified timezone in the HTTP headers.
e.g.
Last-Modified: October 21, 2009 00:00:00 GMT
Expires: October 28, 2009 00:00:00 GMT
Do you know if the browser only understands GMT, or can we specify any other timezone in these HTTP headers ?
e.g.
Last-Modified: October 21, 2009 00:00:00 PDT
Expires: October 28, 2009 00:00:00 PDT
Thanks in advance,
Vivek
In this global world of ours, it makes sense to send these Expires and other time-related elements in GMT, and that is indeed what the standard requires.
With regards to the format, HTTP (RFC2616) specifies the Expires header element's format to comply with RFC1123 itself pointing to RFC802.
With regards to the timezone, however Section 3.3.1 explicitly states:
All HTTP date/time stamps MUST be represented in Greenwich Mean Time (GMT), without exception. For the purposes of HTTP, GMT is exactly equal to UTC (Coordinated Universal Time). This is indicated in the first two formats by the inclusion of "GMT" as the three-letter abbreviation for time zone, and MUST be assumed when reading the asctime format. HTTP-date is case sensitive and MUST NOT include additional LWS beyond that specifically included as SP in the grammar.
Using PDT may be OK, but other time zone abbreviations are not necessarily unambiguous and not necessarily recognized. EST for sure is ambiguous (as those in eastern Australia would vouch for). The advantage of UTC (Universal Time, Coordinated - aka GMT, Greenwich Mean Time) is that there are no changes, and the system clock (on Unix and derivatives) provides the time as the number of seconds since 'the epoch', which was 1970-01-01 00:00:00 +00:00 (a UTC time, though UTC did not formally come into existence until 1972). So, it is easy to obtain the UTC value; it is unambiguous; the offset from UTC does not change.
精彩评论