Hi there,

I was just wondering whether I could get a better explanation for the
fact that mktime() breaks consistency with itself by not allowing you
to get Nov 30 1999 by supplying 0s for month, day, and year. The
manual and the source both say that the reason is that the returned
timestamp would be on Nov 30 1999, and I guess this is somehow not
desirable--but as it it, it has a huge wtf factor since according to
all other rules of the function, that is *exactly* what it should
return.

As it stands, the rules for using this function seem to be:

- 0 for year means the year 2000, unless you have 0 for both day and month;
- 0 for month means the last month of the preceding year, unless you
  have 0 for both day and year; and
- 0 for day means the last day of the preceding year, unless you have
  0 for both month and year.

...when it seems like the rules should be:

- 0 for year means the year 2000;
- 0 for month means the last month of the preceding year; and
- 0 for day means the last day of the preceding month.

As it is, 0 for all three parameters returns -1. Which is in itself
unexpected, given that most PHP functions return false on error, not
-1 like the C version of mktime().

I found a note from stas in the bug database about this, saying that
if you want 30.11.99, why not just supply those values? That argument,
however, simply ignores the point, which is that this function is
internally inconsistent. I know it's documented but it still seems
weird. 


Thanks for any ideas,

Torben
 


-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 +1.604.709.0506


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to