LINUX-8 Basic Command---Date

Source: Internet
Author: User

The 2,date command is used to display, set the system's time or date, in the following format: date[option][+ specify format].

The detailed format for date is as follows:

Date command Format
Parameters Role
%t Skip the [tab] key
%H Hours (00-23)
%I Hours (01-12)
%M Minutes (00-59)
%s Seconds (00-59)
%x Equivalent to%h:%i:%s
%Z Show Time zone
%p Show local AM or PM
%A Day of the Week (Sunday-saturday)
%a Day of the Week (SUN-SAT)
%B Full month (January-december)
%b Abbreviated month (JAN_DEC)
%d Day (01-31)
%j Day of the Year (001-336)
%m Month (01-12)
%Y Full year

Case

@1, viewing current system time

Date

@2, according to "year-month-day hours: minutes: Seconds" format display

Date " +%y-%m-%d%h:%m:%s "

@3, set the system time date is September 1, 2016 8:30: Update hardware clock plus hwclock-w

Date " 20160901 8:30:00 "
[Email protected] ~]# hwclock-w

@4, see the Day of the week

Date +%a

@5, judging today is the first day of the year

Date +%j

LINUX-8 Basic Command---Date

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.