On Saturday, January 11, 2003, at 03:49  PM, Dave Rolsky wrote:

On Sat, 11 Jan 2003, Rich Bowen wrote:
On Fri, 10 Jan 2003, Dave Rolsky wrote:
Can we simply declare 0-based as the standard for day of week and day of year, and 1-based for day of month, month of year, and week of year.
Things should be 1-based if they are 1-based in real usage. [...] Things should be 0 based if they are called by name in general usage. [...]
On second thought, I'm inclined to make an exception for month number, just because we're so used to writing things like 2002-12-06.
Agreed.

I'd go further and suggest using 1-based indexing for all of these return values, except for clearly-labeled zero-based methods, such as month_0. This seems more self-consistent, and more consistent with human calendar usage.

This also allows us to preserve the use of false return values as an indication of undefined or unknown results, in those cases where an exception isn't thrown.

 Nobody ever writes 2002-00-02 or something like that!
Nobody ever writes "the 0th day of the week" either!

-Simon

Reply via email to