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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu Apr 25 12:01:31 2024 UTC