Doc #53798 [ReO->Csd]: specify range for month and day in mktime
| From: | rquadling@php.net | Date: | Wed, 26 Jan 2011 11:06:34 +0000 |
| Subject: | Doc #53798 [ReO->Csd]: specify range for month and day in mktime | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-5865@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53798&edit=1
ID: 53798
Updated by: rquadling@php.net
Reported by: matteosistisette at gmail dot com
Summary: specify range for month and day in mktime
-Status: Re-Opened
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
PHP Version: Irrelevant
Assigned To: rquadling
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2011-01-26 12:06:05] rquadling@php.net
Automatic comment from SVN on behalf of rquadling
Revision: http://svn.php.net/viewvc/?view=revision&revision=307764
Log: mktime and gmmktime's params are a little more complex. Fix
bug#53798
------------------------------------------------------------------------
[2011-01-20 13:49:58] rquadling@php.net
Actually it is a little more complicated than that. You can have any
value, including negatives and values greater than the expected range.
For today, 20th Jan 2011,
php -r "echo date('r', mktime(0,0,0,-10,-3));"
Thu, 28 Jan 2010 00:00:00 +0000
------------------------------------------------------------------------
[2011-01-20 12:09:03] matteosistisette at gmail dot com
Well that's exactly what should be specified in the documentation, or
more simply:
Month: number of the month (1 through 12)
just like it is documented for the date() function
------------------------------------------------------------------------
[2011-01-20 11:46:49] rquadling@php.net
The day, month and year values supplied are not indexes or offsets, so
"0-based"
is not relevant.
------------------------------------------------------------------------
[2011-01-20 11:41:10] matteosistisette at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.mktime
---
Documentation says about the "month" parameter:
"month
The number of the month.
"
It should specify that this is 1-based, i.e. January is 1 and December
is 12.
This is not obvious, as some languages use 0-based indexes (i.e. 0 for
january and 11 for december)
To be rigorous, the same holds for days, thought I guess it is more
obvious that the first day of the month is counted as 1 and not 0 so
this may not be necessary, thought it wouldn't hurt.
Anyway for the number of the month it is absolutely vital to specify it.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53798&edit=1