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:秒鐘

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