Linux system date Command modification time and Hwclock hardware time

Source: Internet
Author: User

Date Modified:

The order of 5 months ' time is set as follows:

#date-S 05/18/2016

Modification Time:

The command to set the system time to ten minutes in the morning is as follows.

#date-S 10:10:40

To modify the time zone:

Locate the appropriate time zone file /usr/share/zoneinfo/asia/shanghai Replace the current /etc/localtime.

Modify The contents of the/etc/sysconfig/clock file as:

Zone= "Asia/shanghai"

Utc=false

Arc=false

Hwclock: Hardware clock

-W: Synchronizing system time to hardware time

-S: Synchronizing hardware time to System time

the function of the date command is to display and set the system date and time.

Enter date to view the current system time.

Modify time requires date- functional character modified content

The meanings of each of the options in the command are:

-D datestr,--date DATESTR displays the date described by Datestr

-S Datestr,--set datestr set the date of the datestr description

-U,--universal display or set Universal Time

Time Domain

%H hours (00..23)

%I hours (01..12)

%k hours (0..23)

%l hours (1..12)

%M points (00..59)

%p Show AM or PM

%r time (hh:mm:SS AM or PM), hours

%s from 1970 year 1 month 1 date :xx:The number of seconds that have been experienced so far

%s seconds (00..59)

%T time (in- hour system) (hh:mm:ss)

%x display time format (%H:%M:%S)

%Z time zone Date field

%a the abbreviation for the day of the week ( Sun. Sat)

%A The full name of the week (Sunday. Saturday)

%B month abbreviation (Jan. Dec)

Full name of%B month (January. December)

%c Date and time (Wed 10:27:35 PDT)

%d the day of the one month (01..31)

%d Date (mm/dd/yy)

%h and %b options are the same

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

%m Month (01..12)

%w Day of the week one (0 for Sunday)

%W Week of the year (00..53, Monday for first day)

%x format for displaying dates (mm/dd/yy)

The last two digits of the%y year (+ )

%Y Year (ex:1970, etc.)

Example:date +%y-%m-%d\%h:%m:%s display:2016-05-18 10:20:23

in particular, only the superuser can set the time with the date command, and the average user can only display the time with the date command.

Example 1: Displays the time in the specified format.

Date ' +this date ' =>%x, time Isnow =>%x, thank you! '

This date is =>05/18/2016, time Isnow =>10:25:53 AM, thank!

Example 2: Displays the current time in a predetermined format.

# date

Wed 10:27:35 PDT 2016

Example 3: Set the time for the morning ten points .

# date-s 10:36:00

Wed 10:36:00 PDT 2016

Example 4: Set the time to 5 months in the year .

# date-s 160518

Wed 00:00:00 PDT 2016

Example: Setup time 5 months 12:00

# date-s "2016-05-18 12:00:00"

when you have finished modifying the time, remember to use hwclock–w to synchronize the system time to hardware time.


This article is from the "Looger" blog, make sure to keep this source http://lsbhjshyn.blog.51cto.com/1336660/1774630

Linux system date Command modification time and Hwclock hardware time

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.