php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #26793 strtotime() additions
Submitted: 2004-01-05 08:22 UTC Modified: 2004-09-17 14:24 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: kulakov74 at yandex dot ru Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2004-01-05 08:22 UTC] kulakov74 at yandex dot ru
Description:
------------
I think strtotime() and probably the more general "Date and Time Functions" chapter need these additions:

1. Daylight Savings Time stuff should be explained; it should be clearly stated that one can't do integer arithmetics right with timestamps because of DST. At least strtotime() handles this correctly (another option is maketime()), so it should be used whenever, say, we need to add 7 days to a date as in strtotime('+7 days', $Date),
while this is wrong: $Date+=7*24*3600. 
This will prevent a lot of developers new to the date&time issue from stumbling over the problem and reporting another "bug" answered with a congratulation on DST discovery. 

2. Descriptions of all the formats for the "time" parameter in strtotime() should be included in the PHP documentation itself; providing just a link to GNU Tar Date formats does not necessarily leads to following the link and therefore leads to misunderstanding of the "time" parameter formats, hence to another wave of "bug" reports about "next [weekday]" unexpected behavour. 

Reproduce code:
---------------
Current (online) strtotime() documentation

Expected result:
----------------
I think people should be able to know what strtotime() will return and avoid the described pitfalls when they have read the PHP docs alone


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-15 16:48 UTC] chris at free-source dot com
Also on the strtotime page the link to the GNU utils man page is dead.
 [2004-09-17 14:24 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

"Make sure to take daylight saving time into consideration (use e.g. $date = strtotime('+7 days', $date) and not $date += 7*24*60*60)."

The link didn't work only a while and the documentation is quite complex so I didn't integrate it.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Nov 19 11:00:01 2025 UTC