News for hackers. Stuff that matters.
Re:Why is day of the month 1-indexed but the month is 0-inde... by kube-system on Tuesday November 24, 2020 @01:33AM (#25195905)
Days are natural numbers.

Months are a string array.

It seems intuitive to me. If you looked at a calendar and typed the data, that’s what you’d end up with.

Re:Why is day of the month 1-indexed but the month is 0-inde... by mhd on Tuesday November 24, 2020 @03:27AM (#25196448)
Well, if everything were based on how it appears in a calender, you'd think that Americans would start their friggin dates with the month, too ;)

In German I'd say that both two number dates (lit. "schedule a meeting for the ninth eighth") as well as month names (lit. "my birthday is on the eighteenth May") is common, so we might be more accustomed to thinking of months as numbers. If Roman emperors would've done a better job, we all would.

I think Windows does months as 1-indexed, but then makes a mess of days of the week.

Re:Why is day of the month 1-indexed but the month is 0-inde... by samatman on Tuesday November 24, 2020 @03:49AM (#25196558)
> you'd think that Americans would start their friggin dates with the month, too

We... do? America writes dates such as March 14th 2020 as 3/14/20. ISO 8601 is of course superior but I like the month-first approach, because "the 14th day of" doesn't tell you anything until you know "March", it seems more natural.

Re:Why is day of the month 1-indexed but the month is 0-inde... by philwelch on Tuesday November 24, 2020 @06:16AM (#25197427)
I actually find the European custom more logical.

If we are having a casual conversation and I’m referring to a previous event that happened on the 14th, you can assume from context that I mean the 14th of the current or previous month (eg the 14th of November as of the writing of this comment). If it isn’t the current month (+-1 based on context), I can instead specify that I meant the 14th of September and you will understand that I mean the 14th of September this current year (again +-1 by context). If I meant the 14th of September, 1987, I will say the whole date. But since most date-based conversations have an implied context, being able to simply truncate dates for brevity is useful.

ISO 8601 is big-endian, European style is little-endian, and US-style is just kind of pointless.

Re:Why is day of the month 1-indexed but the month is 0-inde... by kingofpandora on Tuesday November 24, 2020 @07:06PM (#25204514)
> ISO 8601 is big-endian, European style is little-endian, and US-style is just kind of pointless.

US-style is middle-endian.

Re:Why is day of the month 1-indexed but the month is 0-inde... by mhd on Tuesday November 24, 2020 @05:57AM (#25197311)
Too early today for me to write posts ;)

"Year" first would be more the point where it gets confusing, as when you really start reading the details from a calendar, the year would be first, too. (When you're actually talking, of course, the year is rarely mentioned.)

I'm just saying that going from how you say something in your native language to internal data representation is quite error-prone.

Re:Why is day of the month 1-indexed but the month is 0-inde... by MattConfluence on Tuesday November 24, 2020 @05:14PM (#25203609)
"March 14th 2020" is perfectly fine both when spoken and written. It's not easy to sort lexicographic by programs, but that's not the most important aspect.

The problem is that the existence of both MM/DD/YY and DD/MM/YY makes dates less than the 13th of the month ambiguous. People do seem to get hung up on not going from smallest to largest unit (or the other way around), but the ambiguity is the real problem in my opinion. And of course it becomes a tribal thing, "the other guys are wrong about their format, we should keep ours and drop theirs". The best thing would be to just drop MM/DD/YY and DD/MM/YY in favor of _any_ format that is universally understood as unambiguous.

Re:Why is day of the month 1-indexed but the month is 0-inde... by jhoechtl on Tuesday November 24, 2020 @04:17AM (#25196707)
Sorting becomes so much easier though wenn its yyyy-mm-dd
Re:Why is day of the month 1-indexed but the month is 0-inde... by globular-toast on Tuesday November 24, 2020 @10:22AM (#25199230)
"March" doesn't tell you anything until you know 2020. It seems like you need the entire date before you know anything at all, so I don't think this argument holds. I think it's arbitrary like most natural language. There is no logic, it's just like that because people do it that way.
Re:Why is day of the month 1-indexed but the month is 0-inde... by samatman on Tuesday November 24, 2020 @02:27PM (#25202060)
Not true, if I say "my birthday is in March" you know something about every year. If I say "my birthday is the 14th" you know... nothing useful.

It is of course arbitrary, like anything in natural language; if I thought it were a matter of logic, I would have said something other than "feels more natural"!

I name-checked ISO 8601 for a reason; that's how I write my dates now, and as a developer, if you store dates as anything other than a Unix timestamp or ISO 8601, I judge you for it ;)

but you'll notice it puts the month before the day...

Re:Why is day of the month 1-indexed but the month is 0-inde... by globular-toast on Wednesday November 25, 2020 @05:59AM (#25207948)
That's true for anniversaries. Some things happens every month too. "I get paid on the 29th". "The bill is due on the 1st".

ISO-8601 does indeed put the month before the day, but it puts the year before the month too. The problem people have with the American format is that it's mixed. Y-m-d makes a lot of sense, but d-m-Y kind of does too. m/d/Y is just weird and it's literally the only country in the world to do it.

Re:Why is day of the month 1-indexed but the month is 0-inde... by treeman79 on Tuesday November 24, 2020 @06:45AM (#25197567)
Lots of News websites give month and day, but no year.
Re:Why is day of the month 1-indexed but the month is 0-inde... by deepsun on Tuesday November 24, 2020 @01:37AM (#25195924)
Month is not always string array, for example in ISO: 2020-11-23.

And days can be string as well: "1st November".

Re:Why is day of the month 1-indexed but the month is 0-inde... by kube-system on Tuesday November 24, 2020 @01:52AM (#25196003)
It was a string array first. ISO came long after the Gregorian calendar. And the months came from the Julian calendar.

If we go all the way back, one could say it was a mixed array of string and integer. September (7), October (8), November (9), and December (10) are linguistically ordinal names... but they’re all off by two since the deprecation of the Roman calendar.

Re:Why is day of the month 1-indexed but the month is 0-inde... by jsrjenkins on Tuesday November 24, 2020 @03:44AM (#25196532)
Actually the Romans counted their months beginning with March:

March (1) April (2) May (3) ... July (5) (named after Julius Caesar) August (6) (named after Augustus) September (7) ... etc.

The reason being in the ancient world all serious activity begins in the spring, especially war campaigns which were to be under the aegis of the god Mars, from which the name of the month.

Note that when we have a leap year we add the extra day to the end of the Roman year, that is at the end of February which is the last month of the year.

More precisely, we duplicate the sixth of the calends of March. This is why in French the leap year is called 'bisextile'.

Re:Why is day of the month 1-indexed but the month is 0-inde... by 082349872349872 on Tuesday November 24, 2020 @02:22AM (#25196131)
Since Julius and Augustus.

(written 4 Freezy 229)

Re:Why is day of the month 1-indexed but the month is 0-inde... by _Microft on Tuesday November 24, 2020 @03:39AM (#25196503)
It was a list of names long before it was considered "a string array".
Re:Why is day of the month 1-indexed but the month is 0-inde... by coding123 on Tuesday November 24, 2020 @03:23AM (#25196415)
This is the correct answer.

Months often need to be translated to a name.

A day of month is not translated to a name.

Re:Why is day of the month 1-indexed but the month is 0-inde... by tshaddox on Tuesday November 24, 2020 @03:43AM (#25196526)
I’d argue that the day of month is overwhelmingly described with a name corresponding to its 1-index.
Re:Why is day of the month 1-indexed but the month is 0-inde... by coding123 on Wednesday November 25, 2020 @12:20PM (#25211618)
So there's that too then. :)