Shell Date Command Get time--rich and colorful

Source: Internet
Author: User

The simplest output:

# datewed June   6 : £2018

1. Gets the current time, output in the specified format:

 # date +%y-%m-%d standard output date (where: + must be,-optional, can also be output according to the specified style, for example:/,* 2018 -06 -06  Span style= "COLOR: #000000" ># date   " +%y-% m-%d%h:%m:%s.%n   "  display month day minute minutes seconds  2018 -06 -06  16 : 35 : 02.955352720  # date   " +%y%m%d%h%m%s%n   "  can be used as a timestamp  20180606163640400503349  

2. Get the time before and after the current date, date with parameter-D, before before, without before:

# date-d'1 days ago'+%y-%m-%D2018- .- to# Date-D'1 Days'+%y-%m-%D2018- .- -# Date-D'1 years ago'+%y-%m-%D .- .- .# Date-D'1 Years'+%y-%m-%D2019- .- .# Date-D'1 months ago'+%y-%m-%D2018- to- .# Date-D'1 months'+%y-%m-%D2018- -- .# Date-D'1 minutes ago' "+%y-%m-%d%h:%m:%s"2018- .- .  the: -: -

3. Get the current day of the year, the month of the week, etc.

# date +%J   #当年的第N天 157+%w #当周的第N天 3+%d #当月的第N天  .

For more information, please enter: Date--help online Help.

Shell Date Command Get time--rich and colorful

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.