Subject: bug#72023: feature request for date(1): strptime-style format string when you don't want date to guess

From: <[email-masked]>
Date: Tue, 9 Jul 2024 20:29:44 +0000

I suspect this has been requested many times over the decades but I haven't found anything in the issue tracker so...
The date command lets you choose my output format, but for input it tries to figure it out without hints.  For interactive use, this is great.
For usage in scripts, this is less than ideal, because that means you need to understand the heuristics to have confidence that your script will do what you want.
For instance, this page:
https://www.gnu.org/software/coreutils/manual/html_node/Pure-numbers-in-date-strings.html
says that "If the decimal number is of the form yyyymmdd [...] yyyy is read as the year"
I stared at that sentence for a bit in confusion, thinking to myself "but how could it possibly KNOW that the number is of the form yyyymmdd??"
I finally realized that what it's really saying is that "if the number is exactly 8 digits long, we ASSUME that the first four digits are the year".
Thus, if you have an 8-digit number that you want to interpret differently then you should massage it before passing it to date.

As it happens, I have an 8 digit number, and indeed the built-in assumptions happen to be a perfect fit for me.
But I still don't like to rely on them if I don't have to, and would rather just tell it what I already know, instead of forcing date(1) to re-derive it.

Thoughts?
Mark.

This message is for information purposes only. It is not a recommendation, advice, offer or solicitation to buy or sell a product or service, nor an official confirmation of any transaction. It is directed at persons who are professionals and is intended for the recipient(s) only. It is not directed at retail customers. This message is subject to the terms at: https://www.ib.barclays/disclosures/web-and-email-disclaimer.html. 

For important disclosures, please see: https://www.ib.barclays/disclosures/sales-and-trading-disclaimer.html regarding marketing commentary from Barclays Sales and/or Trading desks, who are active market participants; https://www.ib.barclays/disclosures/barclays-global-markets-disclosures.html regarding our standard terms for Barclays Investment Bank where we trade with you in principal-to-principal wholesale markets transactions; and in respect to Barclays Research, including disclosures relating to specific issuers, see: https://publicresearch.barclays.com.
__________________________________________________________________________________ 
If you are incorporated or operating in Australia, read these important disclosures: https://www.ib.barclays/disclosures/important-disclosures-asia-pacific.html.
__________________________________________________________________________________
For more details about how we use personal information, see our privacy notice: https://www.ib.barclays/disclosures/personal-information-use.html. 
__________________________________________________________________________________