[[Email protected] shell]# date +%y year, 4-digit
2018
[[Email protected] shell]# date +%y year, 2-digit
18
[[Email protected] shell]# date +%m Month
04
[[Email protected] shell]# date +%m M, number of minutes
57
[[Email protected] shell]# date +%d
13
[Email protected] shell]# date +%d Month Day year
04/13/18
[Email protected] shell]# date +%y%m%d
20180413
[Email protected] shell]# date +%f
2018-04-13
[[Email protected] shell]# date +%h hours
16
[[Email protected] shell]# Date +%s timestamp
1523607008
[[Email protected] shell]# date +%s second seconds
17
[Email protected] shell]# date +%t
16:12:32
[[Email protected] shell]# Date +%w day of the week
5
[Email protected] shell]# Date +%w the week of the year
15
[[email protected] shell]# date-d "-1 day"
Thu APR 16:19:26 CST 2018
[Email protected] shell]# date-d "-1 day" +%f
2018-04-12
[Email protected] shell]# date-d "-1 month" +%f
2018-03-13
[Email protected] shell]# date-d "-1 year" +%f
2017-04-13
[Email protected] shell]# date-d "-1 Years" +%f
2017-04-13
[Email protected] shell]# date-d "-1 Hour" +%t
15:22:39
[Email protected] shell]# date +%s
1523607974
[Email protected] shell]# date-d @1523607974
Fri APR 16:26:14 CST 2018
20.1 shell script introduces 20.2 shell script structure and executes 20.3 date command usage 20.4 A variable in a shell script