Linux – Yesterday’s Date in YYYYMMDD format

Linux Bash code for yesterday’s date in YYYYMMDD format

$ date --date="yesterday" +"%Y%m%d"
20151128
$ date --date="-1 days" +"%Y%m%d"
20151128

Mac Bash code for yesterday’s date in YYYYMMDD format

$ gdate --date="yesterday" +"%Y%m%d"
20151128
$ gdate --date="-1 days" +"%Y%m%d"
20151128
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit

Comments

Click here to write/view comments