How to get the past Mon/Tue/.. not after the current date?
From:
Peng Yu
Subject:
How to get the past Mon/Tue/.. not after the current date?
Date:
Tue, 20 Jul 2021 19:36:15 -0500
Hi,
$ date -d 'last Tue' +%Y-%m-%d
2021-07-13
$ date +%Y-%m-%d
2021-07-20
$ date -d 'last Mon' +%Y-%m-%d
2021-07-19
I want to get the last day of week not in the future. In the above
example, I want to get this Tue (2021-07-20) instead the last Tue
(2021-07-13). But for Mon, I want to get 2021-07-19. Is there a date
string to get such output?
--
Regards,
Peng
[Prev in Thread]
Current Thread
[Next in Thread]
How to get the past Mon/Tue/.. not after the current date?,
Peng Yu<=