php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34874 strtotime("<Day>",<time>) output differs from earlier PHP5 versions
Submitted: 2005-10-14 17:36 UTC Modified: 2005-10-20 10:09 UTC
From: dverspui at hotpop dot com Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 5.1.0RC1 OS: Linux (Fedora 2)
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: dverspui at hotpop dot com
New email:
PHP Version: OS:

 

 [2005-10-14 17:36 UTC] dverspui at hotpop dot com
Description:
------------
strtotime("<day>",<time>) returns the specified day of the next week of <time> if <time> itself is on day <day>.


Reproduce code:
---------------
print date("Ymd",strtotime(date("l",time()),time()));


Expected result:
----------------
Output should be the date of today, but on my installation it returns the date of 7 days ahead. This differs from all earlier PHP versions.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-14 21:40 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-10-15 00:09 UTC] dverspui at hotpop dot com
Hi, thanks for your reply.
I succesfully compiled 5.1.0RC3-dev you gave me the link to, but the problem remains!
 [2005-10-15 00:19 UTC] tony2001@php.net
Looks like a feature, but I'm not sure.
Please have a look.
 [2005-10-18 13:54 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This was a bug in all earlier version. If today is "Tuesday October 18th" then the string "Tuesday" refers to the next one, which is October 25th.
 [2005-10-18 14:41 UTC] dverspui at hotpop dot com
Hi Derick,

I would agree if it would include "next" like in:

print date("Ymd","next " . strtotime(date("l",time()),time()));

I think people in many projects have been using my
earlier example with all PHP versions prior to 5.1.0
and this breaks their code. E.g. I bumped into this when
using PHP iCalender.

After all, I cannot seem to find any exact specs on what
strtotime should return for my example. The manual nowhere
tells me that it will e.g. return next weeks tuesday if
the specified time is on a tuesday. It will definitely
returns a tuesday, but which one then??
 [2005-10-19 23:11 UTC] derick@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2005-10-20 10:09 UTC] dverspui at hotpop dot com
Thanks, works great!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 03:01:33 2024 UTC