linux date命令参数及用法详解--linux查看修改系统时间(国外英文资料)
linux date命令参数及用法详解--linux查看修改系统时间(国外英文资料)
The date command
The function of the date command is to display and set the system date and time.
The general format of this command is: date [option] displays the time format (in the form of +, followed by format)
Date sets the time format
The meanings of the options in the command are:
-d datestr, the date datestr displays the date described by the datestr
-s datestr - set datestr sets the date for the datestr description
-u, -universal displays or sets the universal time domain
% H hours (00.. 23)
% I hours (01.. 12)
% k hours (0.23)
% l hours (1.. 12)
% M (00.. 59)
% p shows AM or PM
% r time (hh: mm: ss AM or PM), 12 hours
% s is the number of seconds passed from 00:00:00 on January 1, 1970
% S seconds (00.. 59)
% T time (HHH: mm: ss)
% X display the format of time (% H: % S)
The % Z time zone date field
(Sun.. Sat)
(Sunday.)
(Jan. Dec)
The full name of % B is January.
% c date and time (Mon 11:8 14:12:46 CST 1999)
The first few days of a month (01.. 31)
% D date (mm/dd/yy)
The % h is the same as the % b option
The first few days of the year (001.. 366)
% m month (01.12)
The day of the week (0 for Sunday)
The first weeks of the year (00.. 53, Monday is the first day)
% x displays the format of the date (mm/dd/yy)
The last two digits of % y (1999 is 99)
% Y years (e.g. 1970, 1996, etc.)
It is important to note that only a super user can set the time with the date command, and the average user can only use the date command to display the time.
The following environment variables will affect the execution of the date command. The information is compiled at
LANG determines the default locale that will be used when LC_ALL and the corresponding environment variables (at the beginning of the LC_) do not specify the locale.
LC_ALL determines the locale of any locale of any locale that is set by LANG or any environment variable that starts with LC_.
LC_CTYPE determines the byte sequence of text data to be interpreted as a lang