How to print dd-mmm-yyyy
in bash (e.g 02-Jun-2019)
today=$(date +%d-%m-%Y -d "yesterday")
which doesn't give the desired result
I expected to get 02-Jun-2019
but output is 02-06-2019
How to print dd-mmm-yyyy
in bash (e.g 02-Jun-2019)
today=$(date +%d-%m-%Y -d "yesterday")
which doesn't give the desired result
I expected to get 02-Jun-2019
but output is 02-06-2019
You can do something like:
date -d "yesterday" '+%d-%b-%Y'
Gives you yesterday's date in the format you desire:
02-Jun-2019
If you want it to be May
, then you can do:
date -d "yesterday -1 month" '+%d-%b-%Y'
Gives you:
02-May-2019