Shell Date formatted output

Source: Internet
Author: User
Tags locale month name

1-echo ' Date ' +%y-%m-%d%h:%m:%s "'

2014-11-13 15:06:26

2-echo ' Date ' +%y-%m-%d%h:%m:%s "'

14-11-13 15:06:51

Note: "+%y-%m-%d%h:%m:%s" case

The given format controls the output, and the sequence is interpreted as follows:

Percent of a text%
%a of the current locale (ex: day, for Sunday)
%A the full name of the current locale (for example: Sunday)
%b the month name of the current locale (for example: one, for January)
%B the full name of the current locale (for example: January)
The date and time of the current locale of%c (for example: March 3, 2005 Thursday 23:05:25)
%c century; For example,%Y, typically omitting the last two digits of the current year (for example: 20)
%d date by month (ex: 01)
%d Date by month; equal to%m/%d/%y
%e date by month, add a space, equal to%_d
%F full date format, equivalent to%y-%m-%d
%g last two bits of the ISO-8601 format year (see%G)
%G ISO-8601 format year (see%V), typically used only with%V
%h equals%b.
%H hours (00-23)
%I Hours (00-12)
%c date by year (001-366)
%k (0-23)
%l (1-12)
%m Month (01-12)
%M points (00-59)
%n line break
%N nanosecond (000000000-999999999)
%p "Morning" or "afternoon" under current locale, output empty when unknown
%P is similar to%P, but outputs lowercase letters
%r 12-hour clock time at current locale (e.g. 11:11:04 pm)
%R 24 hours of time and minutes, equivalent to%h:%m
%s number of seconds since 1970-01-01 00:00:00 UTC time
%s seconds (00-60)
%t Output Tab tab
%T time, equal to%h:%m:%s
%u week, 1 stands for Monday
%u week of the year, with Sunday as the first day of the Week (00-53)
%V ISO-8601 Format Specification for the week of the year, with Monday as the first day of the Week (01-53)
%w Day of the Week (0-6), 0 for Monday
%W Week of the year, with Monday as the first day of every week (00-53)
Date description under the current locale of%x (for example: 12/31/99)
Time description Under current locale of%x (e.g. 23:13:48)
%y year last two digits (00-99)
%Y year
%z +HHMM Digital Time zone (for example,-0400)
%:z +hh:mm Digital Time zone (for example, -04:00)
%::z +HH:MM:SS Digital Time zone (for example, -04:00:00)
%:::z Digital time zone with the necessary precision (for example, -04,+05:30)
%Z time zone abbreviations by alphabet (for example, EDT)

Shell Date formatted output

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.