Usage: date [options] ... [+ format]
Or: Date [-u|--utc|--universal] [MMDDHHMM[[CC]YY][.SS]]
Displays the current time in the given format, or sets the system date.
-D,--date= string to display the time described by the specified string, rather than the current time-
f,--file= date file similar to--date, read time by line from the date file-
R,--reference= file Displays the last modified time of the file's specified file-
R,--rfc-2822 the date and time in RFC 2822 format
For example: August 7, 2006, Monday 12:34:56-0600
--rfc-3339= Timespec output date and time in RFC 3339 format.
timespec= ' date ', ' seconds ', or ' ns '
indicate the accuracy of the display of dates and times. The
date and time unit is separated by a single space:
2006-08-07 12:34:56-06:00-
s,--set= string setting specifies the string to separate the time-
u,--UTC, Universal output or set Coordinated Universal Time
--help Display this help information and exit
--version display version information and exit
This column more highlights: http://www.bianceng.cn/OS/Linux/
The given format formats control the output, and the interpretation sequence is as follows:
%% of a text%%a current locale (for example: Day, Representative Sunday)%a The current locale of the week name (e.g. Sunday)%b the current locale of the month initials (such as: one, representing January)%b current Loca
Le's full name of the month (for example: January)%c current locale date and time (such as: Thursday, March 3, 2005 23:05:25)%c century; for example,%Y, typically omitting the last two digits (for example: 01) of the current year. %d Date by month; equal to%m/%d/%y%e date by month, add a space, equal to%_d%F full date format, equivalent to the last two digits of%y-%m-%d%g ISO-8601 format year (see%G)%g ISO-8601 format year See%V), generally only combined with%V%h equals%b%h hours (00-23)%I Hours (00-12)%j date (001-366)%k (0-23)%l (1-12)%m month (01-12)%m (00-59)%n newline%n nanosecond (000000000-999 999999)%p the "Morning" or "afternoon" under the current locale, the output is empty when unknown%p is similar to%p, but output lowercase letters%r The 12 hour clock time under the current locale (e.g. 11:11:04 pm)%r 24 hours is equivalent to the number of seconds%s seconds (00-60)%t Output tab tab%t time elapsed since the UTC time 1970-01-01 00:00:00 in%h:%m%s, equal to%h:%m:%s%u weeks, 1 generation Table Monday%u in the first few weeks of the year, in the first few weeks of the year, in Monday, the first day of the Week (01-53)%w the day of the Week (0-6), and 0 for the year of Monday%w, in Sunday, 00-53 (%V) Weeks, with Monday as the first day of the Week (00-53)%x under the current locale date description (such as: 12/31/99)%x under the current locale time description (e.g. 23:13:48%y year last two digits (00-99)%y years%z +hhmm numeric time zone (for example, -0400)%:z +hh:mm Digital time zone (for example, -04:00)%::z +hh:mm:ss numbers Zone (for example, -04:00:00)%:::z the digital time zone with the necessary precision (for example, -04,+05:30)%Z the time zone abbreviation sorted by alphabet (for example, EDT)
By default, the number area of a date is filled with 0.
The following optional tags can be followed by "%":
-(hyphen) Do not populate the field
_ (underline) Fill with space
0 (number 0) with 0 fill
^ If possible, use the capital letter
# If possible, use the opposite case
After any tag also allows an optional field width to be specified, which is a decimal digit.
As an optional cosmetic declaration, it can be an e and, where possible, use the local environment associated with the
Representation, or O, where possible, using the numeric symbols associated with the local environment.
Example:
Output current date and time
Date + "%y-%m-%d%h:%m:%s"
Time to twist DateTime format
date-d @1398004852 + "%y-%m-%d%h:%m:%s"
Capitalize and fill with spaces
Date +%^_10a