php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25937 strtotime weirdness with days of week
Submitted: 2003-10-21 11:45 UTC Modified: 2003-10-21 15:09 UTC
From: six at t0x dot net Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.3.4RC2 OS: Linux 2.4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: six at t0x dot net
New email:
PHP Version: OS:

 

 [2003-10-21 11:45 UTC] six at t0x dot net
Description:
------------
In reproduce code :

strtotime('Monday') returns the timestamp of Sunday/23h, but other ones are okay.

This may be related to the current date (bug submited and results obtained on Tuesday 21st) as there is no bug when querying the timestamp of a day-of-week that's not yet passed.

Reproduce code:
---------------
<?

$a = array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");

foreach ($a as $wd) echo date("d-m-Y H:i:s", strtotime($wd))."\n";

?>


Expected result:
----------------
27-10-2003 00:00:00
21-10-2003 00:00:00
22-10-2003 00:00:00
23-10-2003 00:00:00
24-10-2003 00:00:00
25-10-2003 00:00:00
26-10-2003 00:00:00


Actual result:
--------------
26-10-2003 23:00:00
21-10-2003 00:00:00
22-10-2003 00:00:00
23-10-2003 00:00:00
24-10-2003 00:00:00
25-10-2003 00:00:00
26-10-2003 00:00:00


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-21 15:09 UTC] sniper@php.net
We are happy to tell you that you just discovered Daylight Savings
Time. For more information see:
http://webexhibits.org/daylightsaving/b.html
Instead of using mktime/date consider using gmmktime and gmdate which do
not suffer from DST.

...strtotime($wd.\" GMT\")...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 18 03:01:27 2024 UTC