#23211 [Bgs]: April First Week strtotime day off error
| From: | jmalan at ocurrance dot com | Date: | Tue, 22 Apr 2003 18:04:49 +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-38079@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:
SWEEEEET!!!!!!!!!
There we go, that was what I was missing. You rock man!
Previous Comments:
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
[2003-04-22 10:10:18] jmalan at ocurrance dot com
Maybe that should be stated in the documentation in the strtotime area
so developers know to add that. What would the syntax be if you were
doing last saturday?
------------------------------------------------------------------------
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