Parameters
Show Current time:
[[Email protected] ~]# Date
Wednesday, February 07, 2018 09:56:28 CST
To view the system calendar:
[[email protected] ~]# cal
February on 2018
Day 123456
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28
Cal-y can view a calendar of one year
+ Time Date format: Specify the format of the date and time display
Date +%y (%Y): Displays the year in four-bit (two-bit) number format
[Email protected] ~]# date +%y
2018
[Email protected] ~]# date +%y
18
Date "+%y-%m-%d%h:%m:%s%w"
means: Year, month, day, time, minute, second, week
[Email protected] ~]# Date "+%y-%m-%d%h:%m:%s%w"
2018-02-07 10:02:43 3
When the above parameter combination, there is a special symbol in the middle to add double quotation marks
Date +%f: Displays the full month day
[Email protected] ~]# date +%f
2018-02-07
Date +%w: Shows the current time is the week ordinal of a year
[Email protected] ~]# date +%w
06
Date +%t: Shows the current time
[Email protected] ~]# date +%t
10:05:50
Date +%s: Timestamp
Displays the number of seconds from January 1, 1970 00:00:00 to the current experience
[Email protected] ~]# date +%s
1517969292
Time Stamp conversion:
[[Email protected] ~]# date +%s-d "20180207 10:10:00"
1517969400
[Email protected] ~]# date-d @1517969400
Wednesday, February 07, 2018 10:10:00 CST