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

后端 未结 17 2149
臣服心动
臣服心动 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:07

    Advanced Bash-scripting Guide

    date +%Y:%m:%d -d "yesterday"
    

    For details about the date format see the man page for date

    date --date='-1 day'
    

提交回复
热议问题