-d, --date=STRING display time described by STRING, not 'now'
-d 时间字符串
[gmd@tcbj3-dmetl01 project-iot]$ echo $(date -d'1 day ago' '+%Y%m%d')
20190612
日期格式,都带有百分号
[gmd@tcbj3-dmetl01 project-iot]$ date "+%Y-%m-%d %H:%M:%S"
2019-06-13 18:18:20
[gmd@tcbj3-dmetl01 project-iot]$ date -d today
Thu Jun 13 18:18:27 CST 2019
[gmd@tcbj3-dmetl01 project-iot]$ date -d now
Thu Jun 13 18:18:45 CST 2019
[gmd@tcbj3-dmetl01 project-iot]$ date -d tomorrow
Fri Jun 14 18:18:55 CST 2019
[gmd@tcbj3-dmetl01 project-iot]$ date -d yesterday
Wed Jun 12 18:19:34 CST 2019
[gmd@tcbj3-dmetl01 project-iot]$ date -d '1 day ago'
Wed Jun 12 18:19:08 CST 2019
在当前时间基础上加一天
[gmd@tcbj3-dmetl01 project-iot]$ date -d 'today 1 day'
Fri Jun 14 18:19:21 CST 2019