1
2
3
4
5
6
|
[root@beiyong2 ~]
# date
2016年 07月 17日 星期日 21:02:53 CST
[root@beiyong2 ~]
# date +%F
2016-07-17
[root@beiyong2 ~]
# date +"%F %T"
2016-07-17 21:04:15
|
1
2
3
4
|
[root@beiyong2 ~]
# date -d "-1 month" +%F #显示上一个月的日期
2016-06-17
[root@beiyong2 ~]
# date -d "+1 month" +%F #显示下一个月的日期
2016-08-17
|
1
2
3
|
[root@beiyong2 ~]
# date -s 2016-07-16 #这样设置日期会将具体时间设置为00-00-00
[root@beiyong2 ~]
# date -s 16:10:30 #只设定具体时间,日期将不动
[root@beiyong2 ~]
# date -s "20150505 21:10:01" #设置全部时间
|