tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Weekday abbreviations in output of cal(1)



Hi,

Because yesterday was unsuitable to check for the ambiguity how the second
"1" in that expression is actually parsed.  Is it parsed as in:

	(+1 month 1) thu

as in "go next month, its 1st, forward to Thursday",
or is it:

	+1 month (1 thu)

as in "go next month (same day as today, i.e. 2nd NOW), forward 1 thu".
This would skip the weekdays already passed, such as the upcoming
Saturday on Aug 1st.   And indeed:

	$ date -d '+1 month 1 sat'
	Sat Aug  8 00:00:00 CEST 2020

That is: the expression is, alas, *not* good enough to compute the
"first $WEEKDAY of next month".  I am at a loss how to do this with
NetBSD's date(1).

Thanks for the explanation.

Ok, let's try with a double invocation:

$ date -d "$(date -d '+1 month' '+%m/01/%C%y') sat"
Sat Aug  1 00:00:00 CEST 2020

Ciao,
Wolfgang
--
Wolfgang%Solfrank.net@localhost				Wolfgang Solfrank


Home | Main Index | Thread Index | Old Index