note 25031 modified in function.gmdate by danbrown

From: Date: Sun, 20 Jul 2008 03:15:48 +0000
Subject: note 25031 modified in function.gmdate by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142040@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: <?php 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: <?php 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"); ?> --was-- 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://php.net/manual/en/function.gmdate.php

« previous php.notes (#142040) next »