On Wed, Dec 15, 2021 at 02:09:29PM -0800, Paul Eggert wrote:
> On 12/15/21 12:39, Mike Marchywka wrote:
> > $echo 2000 | date +%Y -f-
> > 2021
> 
> How about this instead? The idea is to avoid
> adding features if they can easily be
> implemented with some other standard utility.
> This way, you can write your shell scripts now
> rather than waiting for a future fix (plus, it
> keeps 'date' simpler).
> 
> echo 2000 | sed 's/$/-07-01/' | date +%Y -f-
> 

That is great until the input format is YYYY-MM-DD :)
The point of using date was to get all the internal
stuff that deals with ambiguous formats and probably
a lot of other people do that too.  
The info documentation does point out how ambiguous
the human readable dates are. I guess 2000 could also
be ms since epoch. I am calling date from c++
and could just ias easily wrap it in another c++ program
to deal with this but thought it was of more general
interest and I did not want to make another kluge.

Generally I agree with your approach but if date is
going to be a swiss army knife for date conversions
it makes some sense to allow user selection of
ambiguity resolution doesn't it? 

Thanks. 




-- 

mike marchywka
306 charles cox
canton GA 30115
USA, Earth 
marchy...@hotmail.com
404-788-1216
ORCID: 0000-0001-9237-455X



Reply via email to