|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 12:00:02 2025 UTC |
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.