Linux Base command (radix) Date command

Source: Internet
Author: User

In the Linux environment, whether it is programming or other maintenance, time is essential, but also often use the operation of time, skilled use of the date command to express the time they want to express, can certainly give their work to bring many convenience.

1. Command format:

Date [parameter] ... [+ format]

2. Command function:

Date can be used to display or set the system's dates and times.

3. Command parameters:

Necessary parameters:

%H hours (expressed in 00-23).

%I Hours (expressed in 01-12).

%k hours (expressed in 0-23).

%l hours (expressed in 0-12).

%m minutes (expressed in 00-59).

%P am or PM.

%r time (including minutes, hours, 12 hours am/pm to express).

Total number of seconds for%s. The commencement time is 1970-01-01 00:00:00 UTC.

%s seconds (expressed in local idiomatic notation).

%T time (including minutes, hours, the 24-hour system to express).

%x time (expressed in local idiomatic notation).

%Z City.

%A week's abbreviation.

The full name of the%A week.

%b the initials of the English name of the month.

%B the full English name of the month.

%c date and time. Just entering the date directive will also show the same result.

%d date (expressed as 01-31).

%d Date (including month date).

%j the first day of the year.

%m month (expressed as 01-12).

%u the number of weeks in the year.

%w the number of days of the week, 0 for Sunday, 1 for Monday, Yan analogy.

The%x date (expressed in local idiomatic notation).

%y year (expressed as 00-99).

%Y year (in four-digit number).

%n Inserts a new row when it is displayed.

%T Inserts the TAB key when it is displayed.

MM month (necessary)

DD Date (necessary)

HH hours (necessary)

MM minutes (necessary)

SS seconds (selectivity)

Select parameters:

-d< string > Displays the date and time that the string refers to. Double quotes must be added before and after the string.

-s< string > Sets the date and time according to the string. Double quotes must be added before and after the string.

-U displays GMT.

--help online Help.

--version Display version Information

4. Instructions for use:

1. In the display, the user can set the format to display, format set to a plus after a number of tags, where the list of available tags is as follows:%: Print out%:

%n: Next line

%t: Jump Lattice

%H: Hours (00..23)

%I: Hours (01..12)

%k: Hours (0..23)

%l: Hours (1..12)

%m: Min (00..59)

%p: Show local AM or PM

%r: Direct Display time (12-hour system, format hh:mm:ss [ap]m)

%s: Number of seconds from January 1, 1970 00:00:00 UTC to date

%s: sec (00..61)

%T: Direct Display time (24-hour system)

%x: Equivalent to%h:%m:%s

%Z: Show time zone%a: Day of the Week (Sun. Sat)

%A: Day of the Week (Sunday. Saturday)

%b: Month. DEC)

%B: Month (January. December)

%c: Show date and time directly

%d: Day (01..31)

%d: Direct display date (MM/DD/YY)

%h: same% B

%j: The first day of the Year (001..366)

%m: Month (01..12)

%u: The week of the Year (00..53) (with Sunday as the first day of the week)

%w: The first day of the Week (0..6)

%w: The first few weeks of the year (00..53) (in Monday case for day one of the week)

%x: Direct display date (MM/DD/YY)

%y: Last two digits of the year (00.99)

%Y: Full year (0000..9999)

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.