|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-10-31 06:45 UTC] root at mediamonks dot net
The 'r' format string doesn't work as expected:
print(date("r", 1));
Prints: "Thu, 1 Jan 1970 01:00:01 +0100"
print(gmdate("r",1));
Prints: "Thu, 1 Jan 1970 00:00:01 +0100"
I think the '+0100' should've been 'GMT'.
(Done on a system with GMT+1)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 21:00:01 2025 UTC |
I must be missing something here. date('r') is intended to display an RFC822 date string. Section 5.1 of RFC822 clearly states that +0100 is a perfectly valid way to represent the timezone. So how is this function not working as expected?print(date("r", 1)); Prints: "Thu, 1 Jan 1970 01:00:01 +0100" This is correct, the local timezone is GMT+1. print(gmdate("r",1)); Prints: "Thu, 1 Jan 1970 00:00:01 +0100" This is wrong, it outputs the GMT date & time, but with the timezone "+0100" instead of "GMT". Thus equaling a date of "Wed, 31 Dec 1969 23:00:01 GMT", which is obviously not 1 second after the start of the unix epoch.