Dear Maintainers,
I want to ask what's the exact semantic semantic and functionality of the
keyword "1 day ago" and "yesterday" in parse-datetime2(), which is used by the
`date`-command of coreutils.
Because in a batch job running at every midnight (at 00:00), on 2025-03-31 the
line
YESTERDATE=`date -d "1 day ago" +%Y%m%d`
in a bash script returns `20250329` instead the expected `20250330`!
Note that this is happens at timezone `Europe/Berlin`, 2025-03-30 was the day
of switching to summertime and this day counts 23 hours. From that, I guess
that "1 day ago" is implemented as an equivalent of "24 hours ago" and at
(2025-03-31 00:00) - 24h the corresponding timestamp was (2025-03-29 23:00).
But I would expect that the semantic of "1 day ago" (or even "yesterday", which
seems to be a defined shortcut for this) will take care of this! And MUST
deliver different results for "1 day ago" vs. "24 hours ago" in such a case.
For me, that's (one of) the reason to use an dedicated tool like "date" for an
error-prone calculation.
I am curious about your answer!
Background: This script is used to prepare a typical "rename open logfile
rolling before signaling HUP to the daemon".
greetings
Guido
--
*** 111 Jahre Deutsche Nationalbibliothek: Wir feiern – besuchen Sie uns!
https://www.dnb.de/111jahre ***
Dr. Guido Jäkel
Deutsche Nationalbibliothek
Informationsinfrastruktur / Rechenzentrum / Infrastruktur Unix
Adickesallee 1
60322 Frankfurt am Main
Tel: +49 69 1525 -1750
mailto:[email protected]
http://www.dnb.de