Live data from Hacker News

History of Zero-Based Months?

jefftk.com

1–10 of 30 posts

Re: History of Zero-Based Months?

#3
post #2

At least in Perl, the rationale for this (apart from copying C) is that it's very easy to reference a list (array) of month names if the month indices are zero-based.

How difficult is it to either subtract 1 before indexing your array, or have a 13 element array with a dummy value in element 0? Deprecate time.h and adopt ISO 8601 already.

Re: History of Zero-Based Months?

#5
post #4

"Why is day of the month 1-indexed but the month is 0-indexed in C?" This Twitter thread from November 2020[1] and its HackerNews discussion[2] seem relevant. 1: https://twitter.com/hillelogram/status/1329228419628998665 2: https://news.ycombinator.com/item?id=25195287

Why don't we enumerate days throughout the year?

Re: History of Zero-Based Months?

#6
post #4

"Why is day of the month 1-indexed but the month is 0-indexed in C?" This Twitter thread from November 2020[1] and its HackerNews discussion[2] seem relevant. 1: https://twitter.com/hillelogram/status/1329228419628998665 2: https://news.ycombinator.com/item?id=25195287

Why don't we enumerate days throughout the year?

Because we don't.

Which is probably because it's too fine a granularity, especially historically: even an ordinal month-day had limited use to preindustrial contexts were time-boundaries were necessary quite fuzzy owing to the vagaries of communications or transport.

Technically you don't need years either, but chunky boundaries are useful as both reference points and communication shortcuts.

Re: History of Zero-Based Months?

#7
I think it's important to be able to work with mod(%) 12 for some operations on year month relationship. All years have 12 months. For day of the month you need additional logic to handle diferent lengths... and other issues.

Re: History of Zero-Based Months?

#8
post #2

At least in Perl, the rationale for this (apart from copying C) is that it's very easy to reference a list (array) of month names if the month indices are zero-based.

How difficult is it to either subtract 1 before indexing your array, or have a 13 element array with a dummy value in element 0? Deprecate time.h and adopt ISO 8601 already.

Or put Dec a second time, at 0, and then % 12 works.

Re: History of Zero-Based Months?

#9
post #7

I think it's important to be able to work with mod(%) 12 for some operations on year month relationship. All years have 12 months. For day of the month you need additional logic to handle diferent lengths... and other issues.

This could still work: https://news.ycombinator.com/item?id=32618016

Re: History of Zero-Based Months?

#10
post #4

"Why is day of the month 1-indexed but the month is 0-indexed in C?" This Twitter thread from November 2020[1] and its HackerNews discussion[2] seem relevant. 1: https://twitter.com/hillelogram/status/1329228419628998665 2: https://news.ycombinator.com/item?id=25195287

Why don't we enumerate days throughout the year?

Probably because most calendars started as lunar or lunar-based. There is also the case that separating the year by month could be beneficial for farmers back in the day to plan different activities throughout the year. I've always like the names of the months in the French Republican Calendar[1] because of that.

[1]: https://en.wikipedia.org/wiki/French_Republican_calendar#Mon...

Post reply on HN