In Linux, a variety of time formats are often used, especially in shell scripts, and the default time format is
[Email protected] ~]# datewed Dec 19:43:07 CST 2016
Note: If you have spaces in the stitching date format, you need to use "..." to indicate
Common formats are:
%Y year
%m Month (01-12)
%d date by month (ex: 01)
%H hours (00-23)
%l (1-12)
%M points (00-59)
%s seconds (00-60)
%A the weekday abbreviation of the current locale (for example: Wed)
%A the full name of the current locale (for example: Wednesday)
%b the month name of the current locale (for example, DEC)
%B the full name of the current locale (for example: December)
The date and time of the current locale of%c (for example: Wed 08:06:29 PM CST)
%c century; For example,%Y, typically omitting the last two digits of the current year (for example: 20)
%d Date by month; equal to%m/%d/%y (12/14/16)
%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 (DEC)
%I Hours (00-12)
%k (0-23)
%n line break
%N nanosecond (373917787)
%p "Morning" or "afternoon" under current locale, output empty (PM) when unknown
%P similar to%P, but with output lowercase letters (PM)
%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 (20:09)
%s number of seconds since UTC 1970-01-01 00:00:00 (1481717433)
%t Output Tab tab
%T time, equal to%h:%m:%s (20:11:00)
%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)
Common operations:
[[Email protected] ~]# date "+%y-%m-%d%h:%m:%s" 2016-12-14 20:05:04[[email protected] ~]# date "+%f%T" 2016-12-14 20:13:00 [[Email protected] ~]# date +%r08:14:53 pm[[email protected] ~]# date +%awednesday[[email protected] ~]# date +%hdec
%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)
This article from "Liang Childe" blog, please be sure to keep this source http://iyull.blog.51cto.com/4664834/1882806
Linux Basics-Time format