Detailed Date command

Source: Internet
Author: User

Date command:

Print or set the system date and time

NAME

Date-print or set the system date and time


Synopsis

Date [OPTION] ... [+format]

Date [-u|--utc|--universal] [MMDDHHMM[[CC]YY][.SS]]

Common options:

-D,--date=string displays the time described by the string instead of the current time

-S,--set=string sets the time described by the string ()

-R,--reference=file displays the last modified time of the file

-U,--UTC,--universal print or set UTC



Executing the date command directly on the command line displays the current date and time. Display formats also have several options. To display the specified format, use "+" with the specified options.

The format options can be viewed using man date or date--help.

Common control output Format options:

%y represents the year,

%m represents the month,

%d means day,

%h represents hours,

%m means minutes,

%s represents seconds,

%f represents the complete date year-month-day

%a the name of the full week

%a the name of the abbreviated week

%s represents the number of seconds from January 1, 1970 00:00:00 UTC to date

......

Displays the month and day of the first 10 days

[[Email protected] ~]# date +%f-d " -10 days"

[[Email protected] ~]# date +%f-d "Ten days Ago"

Displayed after 20 days of the month day

[[Email protected] ~]# date +%f--d "+20 days"

Show the day of the week

[[Email protected] ~]# date +%a--d "-2 Days"


Set Time:

Date-s "STRING" or Date [MMDDHHMM[[CC]YY][.SS]] to change the time


Hwclock or clock command to display hardware time

-S,--hctosys to calibrate the system clock, whichever is the hardware clock

Clock-s Correcting system time

-W,--SYSTOHC to calibrate the hardware clock, whichever is the system clock

CLOCK-W Fix Hardware time


This article is from the "Minimonster" blog, make sure to keep this source http://groot.blog.51cto.com/11448219/1829137

Detailed Date command

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.