coreutils
[Top][All Lists]
Advanced

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

Enhancement request to GNU date


From: Yair Lenga
Subject: Enhancement request to GNU date
Date: Thu, 17 Oct 2019 14:22:53 +0300

Greetings,

Would like to ask that you will consider the following extension to 'date'.
The change will make it easier to perform basic date manipulations in
scripts.

The request is to add the following 'suffixes' to the date (similar to the
way relative dates are supported):
* EOM - last date of the month
* BOM - beginning of the month
* EOY - last date on the year
* BOY - first date of the year
* prev EOM - last day previous month
* next EOM - last day next month
* prev EOY, next EOY - ditto.

While all of the constructs can be achieved today, they require multiple
calls to date, with cumbersome formatting. Having those as "built-in" will
make it easier to perform date manipulations.

Consider getting the number of days in the previous month
Now:
INPUT=2019-02-28
date +'%d' -d "$(date +'%Y-%m-01' -d "$INPUT") -1day"
Using PREV EOM
date +'%d' -d "$INPUT prev EOM"

Thank you for taking time to look into this request. Any feedback is
welcomed.
Yair Lenga


reply via email to

[Prev in Thread] Current Thread [Next in Thread]