note 25031 added to function.gmdate
| From: | php-general at lists dot php dot net | Date: | Sun, 08 Sep 2002 14:26:49 +0000 |
| Subject: | note 25031 added to function.gmdate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-36342@lists.php.net to get a copy of this message | ||
Do not use the "T" timezone specifier to generate "GMT", as this may return
"UTC" or "GMT+0000" or "Z" or something else which depends on the
running platform, which would not be RFC1123 compliant.
Use 'D, d M Y H:i:s \G\M\T' which forces the value of the timezone indicator.
Note that RFC1123 requires the use of ENGLISH day and month abbreviations. They MUST NOT be
localized!
An example of the RFC1123 format for full dates is:
Sun, 06 Nov 1994 08:49:37 GMT
Note the presence of the leading 0 (RFC1123 dates have a fixed size, and space padding is prohibited
because it causes problems with fixed size handling when such dates are used in HTTP headers that
may compress whitespaces.
Some proxies accept also the ISO 8601 format, but this is not documented in HTTP/1.1 specs
(RFC2616).
Examples:
header('Date: '.gmdate('D, d M Y H:i:s \G\M\T', time()));
header('Last-Modified: '.gmdate('D, d M Y H:i:s \G\M\T', time()));
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + 3600));
or if you prefer double quotes and don't want to bother with double backslashes:
header("Date: ".gmdate("D, d M Y H:i:s", time())." GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s", time())." GMT");;
header("Expires: ".gmdate("D, d M Y H:i:s", time() + 3600)." GMT");
--
http://www.php.net/manual/en/function.gmdate.php
http://master.php.net/manage/user-notes.php?action=edit+25031
http://master.php.net/manage/user-notes.php?action=delete+25031
http://master.php.net/manage/user-notes.php?action=reject+25031