Linux Date Command

Source: Internet
Author: User
Tags locale month name rfc

Help information for the date command
[Email protected] source]# date--help
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 displays the time described by the specified string, not the current time
-F,--file= date file similar to--date, read-in time description by line from the date file
-R,--reference= file shows the last modified time for file specified file
-R,--rfc-2822 output date and time in RFC 2822 format
Example: August 7, 2006, Monday 12:34:56-0600
--rfc-3339=timespec outputs the date and time in RFC 3339 format.
timespec= ' Date ', ' seconds ', or ' ns '
Represents the display precision of a date and time.
The date and time units are separated by a single space:
2006-08-07 12:34:56-06:00
-S,--set= string sets the specified string to separate the time
-U,--UTC,--universal output or set Coordinated Universal Time
--HELP Display this help message and exit
--version display version information and exit


The given format controls the output, and the sequence is interpreted as follows:


Percent of a text%
%a of the current locale (ex: day, for Sunday)
%A the full name of the current locale (for example: Sunday)
%b the month name of the current locale (for example: one, for January)
%B the full name of the current locale (for example: January)
The date and time of the current locale of%c (for example: March 3, 2005 Thursday 23:05:25)
%c century; For example,%Y, typically omitting the last two digits of the current year (for example: 20)
%d date by month (ex: 01)
%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%y-%m-%d
%g last two bits of the ISO-8601 format year (see%G)
%G ISO-8601 format year (see%V), typically used only with%V
%h equals%b.
%H hours (00-23)
%I Hours (00-12)
%c date by year (001-366)
%k (0-23)
%l (1-12)
%m Month (01-12)
%M points (00-59)
%n line break
%N nanosecond (000000000-999999999)
%p "Morning" or "afternoon" under current locale, output empty when unknown
%P is similar to%P, but outputs lowercase letters
%r 12-hour clock time at current locale (e.g. 11:11:04 pm)
%R 24 hours of time and minutes, equivalent to%h:%m
%s number of seconds since 1970-01-01 00:00:00 UTC time
%s seconds (00-60)
%t Output Tab tab
%T time, equal to%h:%m:%s
%u week, 1 stands for Monday
%u week of the year, with Sunday as the first day of the Week (00-53)
%V ISO-8601 Format Specification for the week of the year, with Monday as the first day of the Week (01-53)
%w Day of the Week (0-6), 0 for Monday
%W Week of the year, with Monday as the first day of every week (00-53)
Date description under the current locale of%x (for example: 12/31/99)
Time description Under current locale of%x (e.g. 23:13:48)
%y year last two digits (00-99)
%Y year
%z +HHMM Digital Time zone (for example,-0400)
%:z +hh:mm Digital Time zone (for example, -04:00)
%::z +HH:MM:SS Digital Time zone (for example, -04:00:00)
%:::z Digital time zone with the necessary precision (for example, -04,+05:30)
%Z time zone abbreviations by alphabet (for example, EDT)


By default, the numeric area of a date is populated with 0.
The following optional tags can be followed by "%" after:


-(hyphen) does not populate the field
_ (underline) fills with spaces
0 (number 0) with 0 padding
^ If possible, use uppercase letters
# if possible, use the opposite case


Also allows an optional field width to be specified after any tag, which is a decimal number.
As an optional cosmetic declaration, it can be E, using the Local environment association if possible
Representation, or O, where possible, using a numeric symbol associated with the local environment.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.