A month ago March 19, 2019 How to get last month’s value. Useful with Bash scripts. LASTMONTH = $(date +%Y%m -d '1 month ago') echo $LASTMONTH # Output is ... 201902LASTMONTH = $(date +%Y%m -d '1 month ago') echo $LASTMONTH # Output is ... 201902