On Sun, 12 Jan 2003, David Wheeler wrote: > My apologies for misunderstanding. What I meant was that, yes, the > 1-starting month numbers are values, rather than array indices. > However, nowhere that I know if is there a situation in which month > numbers are returned 0-indexed, that is, as array indices.
You're wrong, you do know exactly such a situation. Perl's localtime (which is based on C's localtime) returns exactly this (0-11). Days of week are 0-6 (Sun-Sat), and day of year is 0-364. But this interface seems rather outdated and borderline pathological, since it also returns year as number of years since 1900. So it hardly is the basis of a good _generally useful_ datetime API! > But overall, my point is that, with true DateTime objects with good > localization support, there will be very little need for array indexes > for months, day of week, or even day of month. So it makes sense to > make the 1-based enumerations the default for these things, and provide > *_0 methods for those who still want array index-type numbers. Yep. Let's end this particular discussion (0-based vs. 1-based). I'm happy with the 1-based API as default, with *_0 methods for when that is needed. This is a _very_ easy rule to remember, so people should not have to constantly refer to the docs constantly (like I do every damn time I use localtime ;). -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/
