Linux有关日期的表示方法
1date1=`date --date='2 days ago' +%Y%m%d`
2昨天 (前一天)
3date –date='1 days ago' "+%Y-%m-%d"
4date -d '1 days ago' "+%Y-%m-%d"
5date -d yesterday "+%Y-%m-%d"
6明天 (后一天)
7date –date='1 days' "+%Y-%m-%d"
8date -d '1 days' "+%Y-%m-%d"
9date -d tomorrow "+%Y-%m-%d"
101小時前
11date –date='1 hours ago' "+%Y-%m-%d %H:%M:%S"
121小時后
13date –date='1 hours' "+%Y-%m-%d %H:%M:%S"
141分钟前
15date –date='1 minutes ago' "+%Y-%m-%d %H:%M:%S"
161分钟后
17date –date='1 minutes' "+%Y-%m-%d %H:%M:%S"
181秒前
19date –date='1 seconds ago' "+%Y-%m-%d %H:%M:%S"
201秒后
21date –date='1 seconds' "+%Y-%m-%d %H:%M:%S
22date +%w 取得当天是星期几
23date -d 20120311 +%w 取得2012年3月11日是星期几
捐赠本站(Donate)
如您感觉文章有用,可扫码捐赠本站!(If the article useful, you can scan the QR code to donate))
- Author: shisekong
- Link: https://blog.361way.com/date-2/5596.html
- License: This work is under a 知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议. Kindly fulfill the requirements of the aforementioned License when adapting or creating a derivative of this work.