date命令详解

date - print or set the system date and time
synopsis
date [OPTIONS]... [+FORMAT]
date [-u|--utc|--universal] [MMDDhhmm[CC]YY[.ss]]
Description:
Dispaly the current time in the given FORMAT , or set the system date.:按照给定的格式,显示当前时间或者设置系统时间
-d,--date=STRING
display time described by STRING, not 'now'
按照字符串的描述显示时间,不是现在
-f, --file=DATEFILE
like --date once for each line of DATEFILE
类似--date参数显示DATEFILE文件中的每行时间
-r , --reference=FILE
display the last modification time of FILE
显示最后修改FILE的时间
-s,--set=STRING
set time described by STRING
按照STRING描述设置时间
-u, --utc, --universal
print or set Coordinated Universal Time
显示或者设置标准世界时间
--help display this help and exit
--version:output version information and exit
FORMAT controls the output。 Interpreted sequences are:
格式控制输出,把下面的序列解释为:
%% a literal % 字面%
%a locale's abbreviated weekday name(e.g. , Sun) 本地简短的工作日名字
%A locale's full weekday name(e.g.,Sunday) 本地完整工作日名字
%b locale's abbreviated month name(e.g. ,Jan) 本地简短月份名字
%B locale's full month name(e.g. , January) 本地完整月份名字
%c local's date and time (e.g. , The Mar 3 23:05:25 2005)本地日期和时间
%C century; like %Y except omit last two digits(e.g. , 20)世纪,和%Y一样,除了忽略最后两个数字
%d :day of month (e.g ,01) 月份的第几天
%D date; same as %m/%d/%y
%e day of month,space padd; same as %_d
%F full date; same as %Y-%m-%d
%g last of digits of year of ISO week number(see %G)
%G year of ISO week number
%h same as %b
%H hour (00..23)
%I hour(01...12)
%j day of year(001..365)
%k hour(0..23)
%l hour(0..12)
%m hour(01..12)
%M minute(00..59)
%T time; same as %H:%M:%S
%u day of week (1..7) 1 is Monday
%U week number of year ,with Sunday as first day of day of week(00..53)
%V ISO week number,with Monday as first day of week(01..53)
%Y year
以下是一些实验,便于理解:
date -d
date命令详解
date -f
date命令详解

date -r
date命令详解
date -I
date命令详解
date -Ihour
date命令详解

date -Iminute
date命令详解

date命令详解

date -R
date命令详解

date -u
date命令详解

date   +"Today  is  %A"

date命令详解

date +"Date:%b.%e.%G"
date命令详解

date +"%x %X"
date命令详解

date +"%Y-%m-%d %I:%M:%S %p"
date命令详解
date命令设置时间
date [MMDDhhmm[[CC]YY][.ss]]
date 08151702.12
MM:月份
DD:几号
hh:小时
mm:分钟
CCYY:四位年份
YY:两位年份
.ss:秒钟

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章