Doc #53798 [Bgs->ReO]: specify range for month and day in mktime

From: Date: Thu, 20 Jan 2011 12:49:58 +0000
Subject: Doc #53798 [Bgs->ReO]: specify range for month and day in mktime
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-5846@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: Bogus +Status: Re-Opened Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant -Assigned To: +Assigned To: rquadling Block user comment: N Private report: N New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [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

« previous php.doc.bugs (#5846) next »