Mac date command, macdate
usage: date [-jnu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ... [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
Parameter Parsing:
-J: Use-j to use-f
-N: by default, if the scheduled process is running, the date command sets the time on all machines in the Local Group. -N indicates that only the current computer is set.
-U: displays or sets the date to UTC time.
-D: Set the Kernel Time Zone. Generally, this parameter is not required.
-R: second conversion time
-T: (time zone) sets the GMT as the benchmark time zone.
-V: adjust the time according to the parameter
-F: adjust the time according to the format.
+: Some formats of the number pilot, consistent with the normal Linux format
The following are some examples:
View the timestamp of the current time (that is, convert to seconds)
-deMacBook-Pro:~ -$ date +%s1460707049
Convert the current time to the desired format
-deMacBook-Pro:~ -$ date +%Y-%m-%d:%H:%M:%S2016-04-15:16:48:04
View the timestamp of a specific time
-deMacBook-Pro:~ -$ date -j -f %Y-%m-%d 2015-09-28 +%s1443427891
Timestamp to time
-DeMacBook-Pro :~ -$ Date-r 14434297362015-July 16, Monday 16, 16 seconds CST
Convert the timestamp to the desired format
-deMacBook-Pro:~ -$ date -r 1460710262 +%Y-%m-%d:%H:%M:%S2016-04-15:16:51:02
-V: Do not use + |-, change the corresponding time is unknown (year, month, day, hour, minute, second to the corresponding parameter)
-DeMacBook-Pro :~ -$ Date-v5m October 16: 53 minutes 21 seconds CST-deMacBook-Pro :~ -$ Date-v2H: Friday, January 1, April 15, 2016, 45 seconds CST
Use +: Increase the corresponding time
-DeMacBook-Pro :~ -$ Date-v + 2 m, Wednesday, June 15, 2016 seconds CST
Use-: reduce the corresponding time
-DeMacBook-Pro :~ -$ Date-v-2m Monday, December 17, February 15, 2016 CST
-F:-j must be added before-f.
-DeMacBook-Pro :~ -$ Date-j-f % Y-% m-% d 2015-09-282015-Monday, January 1, September 28 CST-deMacBook-Pro :~ -$ Date: Friday, January 1, April 15, 2016, 56 seconds CST
[[Mm] dd] HH] MM [[cc] yy] [. ss]: I do not know how to use this long string.
Cc Century (either 19 or 20) prepended to the abbreviated year.
Yy Year in abbreviated form (e.g., 89 for 1989, 06 for 2006 ).
Mm Numeric month, a number from 1 to 12.
Dd Day, a number from 1 to 31.
HH Hour, a number from 0 to 23.
MM Minutes, a number from 0 to 59.
Ss Seconds, a number from 0 to 61 (59 plus a maximum of two leap seconds ).