| Bug #13885 | gmdate("r"); adds timezone instead of 'GMT'. | ||||
|---|---|---|---|---|---|
| Submitted: | 31 Oct 2001 6:45am UTC | Modified: | 3 Nov 2001 7:43am UTC | ||
| From: | root at mediamonks dot net | Assigned to: | |||
| Status: | Closed | Category: | Date/time related | ||
| Version: | 4.0.6 | OS: | Windows 2000 SP2 | ||
| Votes: | 1 | Avg. Score: | 3.0 ± 0.0 | Reproduced: | 1 of 1 (100.0%) |
| Same Version: | 0 (0.0%) | Same OS: | 0 (0.0%) | ||
[31 Oct 2001 7:00am UTC] rasmus@php.net
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?
[31 Oct 2001 7:11am UTC] root at mediamonks dot net
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.
[31 Oct 2001 7:18am UTC] rasmus@php.net
Ah, ok. Too early in the morning here. Looks like a Windows-specific issue as your test displays this on my Linux box: Wed, 31 Dec 1969 16:00:01 -0800 Thu, 1 Jan 1970 00:00:01 +0000
[3 Nov 2001 7:43am UTC] jmoore@php.net
Fixed in CVS

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)