Get the date (a day before current time) in Bash

后端 未结 17 2152
臣服心动
臣服心动 2020-11-30 17:54

How can I print the date which is a day before current time in Bash?

17条回答
  •  星月不相逢
    2020-11-30 18:05

    if you have GNU date and i understood you correctly

    $ date +%Y:%m:%d -d "yesterday"
    2009:11:09
    

    or

    $ date +%Y:%m:%d -d "1 day ago"
    2009:11:09
    

提交回复
热议问题