[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: date command is great but could use improvements
From: |
Carl Edquist |
Subject: |
Re: date command is great but could use improvements |
Date: |
Mon, 4 Jul 2022 11:00:13 -0500 (CDT) |
On Sun, 3 Jul 2022, David Chmelik wrote:
On 5/26/22 12:16 PM, Carl Edquist wrote:
In the states i am used to Sunday being the first "day of the week",
but "weekdays" refer specifically to Monday-Friday, thus even in the
states, Monday is the first "weekday" :)
'Weekday' abbreviates 'day of week' (including /workdays///schooldays/,
weekends) as in date command manpage ('%A locale's full weekday name
(e.g., Sunday: )')
I was mostly poking fun there, but I'll paste the "weekday" definition
from dict.org, which (despite the way the date(1) manpage uses it)
explains the sense i'm used to in the states:
1 definitions retrieved
"weekday" wn "WordNet (r) 3.0 (2006)"
weekday
n 1: any day except Sunday (and sometimes except Saturday)
I think the confusion comes from conflating ordinal and cardinal
numbers.
No confusion; not at all. How mathematicians/programmers think about
numbers/variables and most think about time/date differ.
Well, if someone thinks 0 is wrong because it implies "zeroth" (an
improperly used ordinal term, which, as you said, nobody uses for the day
of the week), i think that points to the confusion conflating these two
types of units.
Ordinal numbers (first, second, third) describe the order in the
sequence, and cardinal numbers (zero, one, two, three) count how many.
There's no consensus among computer scientists (CS) & mathematicians/CS,
and mathematicians; many say natural (N) & etc. (counting, whole,
whatever one calls various) numbers start from one, but
mathematicians/CS often say from zero: different definitions, but I
almost never focus on 'cardinals versus ordinals:' terms not mentioned
in my original post (OP.)
The difference between cardinal vs ordinal is not about whether you start
the natural numbers with 0 or 1. It's the conceptual difference between
"one" and "first".
I know you didn't mention the terms "cardinal" and "ordinal" by name, but
you did express your shock over days of the week being numbered starting
at 0 (for a variable that represents a cardinal number) instead of 1, and
your reasoning was because people say the week starts with the "first" day
(implying you were thinking of it as an ordinal number).
I really do think this is the key distinction to make to understand these
units. I suspect the confusion tends to come from not making the proper
conceptual distinction between cardinal and ordinal numbers.
Most the world, including most the English-speaking world, uses 24-hour
civilian time but even when says "current time is 0:00" that's ordinal!
To use this as an example: "0:00" has cardinal units in the sense that it
means "0 hours and 0 minutes past midnight" (counting the hours and
minutes). But, to describe that time (midnight) in ordinal terms, it is
"the first minute of the first hour of the day" (describing the place of
the hour and minute within their respective sequences).
Again this emphasizes how cardinal and ordinal units are conceptually two
different perspectives about the same point in time.
The made-up word "zeroth" is a fiction, i suppose, imagined by people
who blur the distinction between ordinal and cardinal numbers. When
something is _first_, nothing comes before it! :)
En.wikipedia.org/wiki/Zeroth cites 'zeroth' in mathematics/CS since
1960s (I heard term in those high school and/or college/university
subjects) and though I couldn't check recent OED updates, Oxford's newer
(not de facto, but documents newer British usage) English dictionary
mentions 'zeroth' since 1800s.
No doubt "zeroth" is a word that gets used in the English language, as is
"unicorn". But i think there is an argument to be made that, when this
word is used, it represents a fiction.
The "Zeroth" wikipedia landing page you mentioned links to the
"Zero-based_numbering" article [1], which i think contains some helpful
points.
[1] https://en.wikipedia.org/wiki/Zero-based_numbering
First of all, i think there is no disagreement that (as it says)
"Numbering sequences starting at 0 is quite common in mathematics
notation".
But the question is what it means when people try to use "zeroth" ("0th")
as an ordinal term. The article actually describes two different uses:
(1) simply an ordinal referring to the initial element in a 0-indexed
sequence, and (2) an ordinal referring to an element that could naturally
be placed _before_ the initial element of a sequence, but that does not
properly belong to the sequence itself.
About (1) it says, "Under zero-based numbering, the initial element is
sometimes termed the zeroth element, rather than the first element", and
it calls this "zeroth" a "coined" ordinal number, which corroborates my
feeling that the term _gets used_ this way, without it being the proper
meaning of the word.
Further, it explains that "There is not wide agreement regarding the
correctness of using zero as an ordinal (nor regarding the use of the term
zeroth) as it creates ambiguity for all subsequent elements of the
sequence when lacking context."
About (2), it says that "zero-based numbering can be used without
confusion, when ordinal forms have well established meaning with an
obvious candidate to come before _first_". And it clarifies that in this
case, "Such usage corresponds to naming an element not properly belonging
to the sequence but preceding it".
A date programming example for (2) would be that the (so-called) 0th of
July refers to the 30th of June. In this case (2), the meaning is
unambiguous, but it is still a fictional term, as "0th of July" does not
actually refer to a date in July (ie, to the sequence of days in July),
but to the day before that month (ie, before that sequence).
This is actually the case for GNU - as the manpage for mktime(3) mentions,
"In many implementations, including glibc, a 0 in tm_mday is interpreted
as meaning the last day of the preceding month."
So in summary regarding the term "zeroth", usage (1) means index 0 in a
0-based sequence, which seems to me incorrect and an abuse of language
stemming from the conflation of cardinal and ordinal numbers; and (2)
means index -1 for a 0-based sequence, or index 0 for a 1-based sequence,
but in any case does not actually refer to an element in the sequence
itself.
So i say "zeroth" is fiction! :)
(And, no, 1900 was not the zeroth year of the 20th century. It was the
100th year of the 19th century!)
Most people say first of 20th century;
Who says this?
I would agree that if someone says "the 1900s", they are referring to the
years 1900-1999 (ie, "the years that start with 19--"). But properly
speaking, "the 20th century" refers to the years 1901-2000, and the 21st
century began in 2001.
I don't think anyone says 'one to 10 are ones; 11 is first of the tens,'
rather than zero or one to nine are ones, and 10 to 19 are tens, etc...
Yeah, likewise when people say "the 90s" they of course mean 1990-1999.
And i don't think anyone ever really talks about decades in an ordinal
sense; but properly speaking, "the 200th decade" refers to 1991-2000.
...
Happy Counting, and Happy Fourth of July!
Carl