[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: |
Thu, 26 May 2022 14:16:57 -0500 (CDT) |
Hi David!
Looks like Bob gave an excellent, thorough reply. (Thanks Bob!)
For fun, a couple details about "counting" caught my eye from your email:
On Fri, 20 May 2022, David Chmelik wrote:
I'm European-American, programming since 1993, and may recall Monday was
first weekday growing up in The United Kingdom (UK,) but moved to USA at
age seven and they said Sunday is /first/ weekday, so that's what I use
until revisiting Europe/Britain.
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" :)
I was shocked to see one can only display Sunday starting week at 0.
Everyone thinks of days 1 to 7, even programmers/sysadmins having to
talk so users understand.
... where Sunday is first weekday (The United States of America, USA,
and I've never heard a programmer/sysadmin/scientist/professor who uses
UNIX/GNU//Linux say 'zeroth weekday')
I think the confusion comes from conflating ordinal and cardinal numbers.
Ordinal numbers (first, second, third) describe the order in the sequence,
and cardinal numbers (zero, one, two, three) count how many.
If you take a close look at the definitions of the members of the tm
structure (as provided in Bob's email), you will see "number of seconds",
"number of minutes", "number of hours", "number of days", "number of
months" -- these are all cardinal numbers (they count how many) and thus
start with zero.
On the other hand, the "day of the month" is an ordinal term, so it starts
with the _first_ (the range is actually *1st* - *31st*).
We're familiar with the "day of the month" being ordinal, but in plain
English, the "day of the week" is usually given with the day's _name_
rather than its ordering. (On the other hand, in Greek, the name for
Monday means "Second", and the name for "Tuesday" means "Third", etc.)
...
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! :)
This of course is the explanation for why 2022 is part of the _21st_
century, as the century is an ordinal description. And for those who
care, even the year number here is ordinal (it actually refers to the
2022th year), which explains why there is no such thing as "year 0".
(There's No Such Thing as the zeroth century or the zeroth year!)
On the other hand, the tm structure stores "The number of years since
1900", which is a cardinal number (how many), thus tm_year=0 -> 1900.
(And, no, 1900 was not the zeroth year of the 20th century. It was the
100th year of the 19th century!)
Happy counting! :)
Carl