Use of TIME commands (date, clock)

Source: Internet
Author: User

Clock displays the time of the hardware

Displays the current time of the hardware

Clock

[Email protected] ~]# clock
Sun Jul 04:54:23 PM CST-0.376669 seconds

Clock-s--hctosys calibration of system time with hardware clock

[[Email protected] ~]# date 051912121995.30
Fri 12:12:30 CST 1995
[[Email protected] ~]# Date
Fri 12:12:35 CST 1995
[Email protected] ~]# clock-s
[[Email protected] ~]# Date
Sun Jul 13:11:30 CST 2016
[Email protected] ~]# clock
Sun Jul 01:11:52 PM CST-1.036958 seconds

Clock-w--SYSTOHC hardware time is corrected with the system clock

[Email protected] ~]# clock
Sun Jul 01:11:52 PM CST-1.036958 seconds
[[Email protected] ~]# date 072416532016.50
Sun Jul 16:53:50 CST 2016
[[Email protected] ~]# Date
Sun Jul 16:53:54 CST 2016
[Email protected] ~]# clock-w
[[Email protected] ~]# Date
Sun Jul 16:54:13 CST 2016
[Email protected] ~]# clock
Sun Jul 04:54:23 PM CST-0.376669 seconds

Displays the current time of the system

Date

[[Email protected] ~]# Date
Sun Jul 17:03:00 CST 2016

Format used by date

Date MMDDHHMMYYYY.SS (Month day hour time minute minute year second seconds)

[[Email protected] ~]# date 072416532016.50
Sun Jul 16:53:50 CST 2016

Displays the current date, in UTC (That is, the zero zone), time

Date-u

[Email protected] ~]# Date-u
Sun Jul 09:04:30 UTC 2016


Displays the current month day

Date +%y-%m-%d

[Email protected] ~]# date +%y-%m-%d
2016-07-24

Displays the number of seconds from 1970 to present

Date +%s

[Email protected] ~]# date +%s
1469351535

Show yesterday's date

Date-d "-1 day"

Date-d "Last Day"

[[email protected] ~]# date-d "-1 day"
Sat Jul 17:15:35 CST 2016
[[email protected] ~]# date-d "Last Day"
Sat Jul 17:15:59 CST 2016


Show tomorrow's date

Date-d "-1 day Ago"

Date-d "+1 Day"

Date-d "1 Day"

[[email protected] ~]# date-d "-1 day Ago"
Mon Jul 17:14:19 CST 2016
[[email protected] ~]# date-d "1 day"
Mon Jul 17:14:36 CST 2016
[[email protected] ~]# date-d "+1 Day"
Mon Jul 17:14:49 CST 2016

Date displayed after 20 days

Date-d "Day"

[Email protected] ~]# date-d "
Sat 17:16:47 CST 2016
[Email protected] ~]# date-d "20day"
Sat 17:18:00 CST 2016

Show dates for the first 10 days

Date-d " -10 Day"

[[email protected] ~]# date-d " -10 Day"
Thu Jul 17:17:18 CST 2016

[Email protected] ~]# date-d " -10day"
Thu Jul 17:18:47 CST 2016

Use of TIME commands (date, clock)

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.