#23211 [Bgs]: April First Week strtotime day off error
| From: | jmalan at ocurrance dot com | Date: | Tue, 22 Apr 2003 18:17:12 +0000 |
| Subject: | #23211 [Bgs]: April First Week strtotime day off error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-38081@lists.php.net to get a copy of this message | ||
ID: 23211
User updated by: jmalan at ocurrance dot com
Reported By: jmalan at ocurrance dot com
Status: Bogus
Bug Type: Calendar related
Operating System: Linux 7
PHP Version: 4.3.1
New Comment:
Unfortunately that still does not answer my question. I know how to get
around the problem but the problem still exists. date("m/d/Y
H:i:s",strtotime("last saturday MST"))
returns 04/04/2003 23:00:00 if the time is after 2 AM sunday morning
the 6th of april. Try it, set your calendar to the 7th of april 2003.
Previous Comments:
------------------------------------------------------------------------
[2003-04-22 13:04:48] jmalan at ocurrance dot com
SWEEEEET!!!!!!!!!
There we go, that was what I was missing. You rock man!
------------------------------------------------------------------------
[2003-04-22 12:04:22] rasmus@php.net
How is the syntax completely different? Those php examples are all
covered by the GNU docs as well. The whole point of the function is
that it understands many different formats.
And if you specify the right timezone in works just fine, just as I
said. Try this:
$ts1 = mktime(12,0,0,4,5,2003);
echo date("l H:i:s m/d/y",$ts1);
echo "<br>\n";
$ts2 = strtotime("last saturday PST",$ts1);
echo "<br>\n";
echo date("l H:i:s m/d/y",$ts2);
$ts3 = strtotime("last saturday PDT",$ts1);
echo "<br>\n";
echo date("l H:i:s m/d/y",$ts3);
This outputs:
Saturday 12:00:00 04/05/03
Saturday 00:00:00 03/29/03
Friday 23:00:00 03/28/03
exactly as expected. I see no bug here.
------------------------------------------------------------------------
[2003-04-22 11:52:55] jmalan at ocurrance dot com
I tried using a timezone and that did not make any difference.
------------------------------------------------------------------------
[2003-04-22 11:50:17] jmalan at ocurrance dot com
I looked at the GNU link on the strtotime page and it states:
1 year
1 year ago
3 years
2 days
In the examples for php it states:
1 day
1 week
next Thursday
last Monday
The syntax is completely different in PHP than GNU: Date Input Formats.
Which brings me back to my original statement, there is a bug in PHP
that interprets "last saturday" (saturday as an example, any day
breaks) incorrectly when daylight savings time is in effect.
------------------------------------------------------------------------
[2003-04-22 11:17:38] rasmus@php.net
There is a link to the format docs on the strtotime manual page.
strtotime() is not a PHP thing, it is a standard library used all over
the place.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/23211
--
Edit this bug report at http://bugs.php.net/?id=23211&edit=1