如你看到的here http://en.wikipedia.org/wiki/List_of_HTTP_header_fields, Last-Modified
标头的日期时间为RFC2616 https://www.rfc-editor.org/rfc/rfc2616 format.
在部分14.29 Last-Modified https://www.rfc-editor.org/rfc/rfc2616#section-14.29你可以看到日期格式应该是:
"Last-Modified" ":" HTTP-date
它的使用示例是
Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
Another quote from RFC2616 read more https://www.rfc-editor.org/rfc/rfc2616#section-3.3 :
所有 HTTP 日期/时间戳必须以格林威治标准时间 (GMT) 表示,无一例外。
在 PHP 中你可以使用格式D, d M Y H:i:s T
如果你使用函数gmdate()
它始终返回 GMT 偏移量/时区中的日期时间:
echo gmdate('D, d M Y H:i:s T');
如果您想使用DateTime
扩大:
$dt = new DateTime('UTC');
#$dt = new DateTime('2013-01-01 12:00:00', new DateTimezone('UTC'));
echo $dt->format('D, d M Y H:i:s \G\M\T');