linux命令總結(jié)之date命令
date%20根據(jù)給定格式顯示日期或設(shè)置系統(tǒng)日期時(shí)間。print%20or%20set%20the%20system%20date%20and%20time
指令所在路徑:/bin/date
date%20[OPTION]...%20[+FORMAT]
date%20[-u|--utc|--universal]%20[MMDDhhmm[[CC]YY][.ss]]
顯示字符串描述的時(shí)間
顯示DATEFILE文件中的每行時(shí)間
顯示文件的最后修改時(shí)間
以RFC-2822兼容日期格式顯示時(shí)間
-rfc-2822
以RFC-2822兼容日期格式顯示時(shí)間
設(shè)置時(shí)間為string
顯示或設(shè)定為Coordinated%20Universal%20Time時(shí)間格式
--help
顯示date命令的幫助信息
--version
顯示date命令的版本信息
要說(shuō)寫這位程序的 David MacKenzie老兄,真是事無(wú)巨細(xì)啊,居然整了這么多格式參數(shù),佩服佩服。
顯示字符%
星期幾的縮寫(Sun..Sat)
星期幾的完整名稱(Sunday...Saturday)
月份的縮寫(Jan..Dec)
月份的完整名稱(January..December)
日期與時(shí)間。只輸入date指令也會(huì)顯示同樣的結(jié)果
世紀(jì)(年份除100后去整) [00-99]
日期(以01-31來(lái)表示)。
日期(含年月日)。
一個(gè)月的第幾天 ( 1..31)
日期,同%Y-%m-%d
年份(yy)
年份(yyyy)
同%b
小時(shí)(00..23)
小時(shí)(01..12)
一年的第幾天(001..366)
小時(shí)( 0..23)
小時(shí)( 1..12)
月份(01..12)
分鐘(00..59)
換行
納秒(000000000..999999999)
AM or PM
am or pm
12小時(shí)制時(shí)間(hh:mm:ss [AP]M)
24小時(shí)制時(shí)間(hh:mm)
從00:00:00 1970-01-01 UTC開始的秒數(shù)
秒(00..60)
制表符
24小時(shí)制時(shí)間(hh:mm:ss)
一周的第幾天(1..7); 1 表示星期一
一年的第幾周linux命令大全,周日為每周的第一天(00..53)
一年的第幾周,周一為每周的第一天 (01..53)
一周的第幾天 (0..6); 0 代表周日
一年的第幾周,周一為每周的第一天(00..53)
日期(mm/dd/yy)
時(shí)間(%H:%M:%S)
年份(00..99)
年份 (1970…)
RFC-2822 風(fēng)格數(shù)字格式時(shí)區(qū)(-0500)
時(shí)區(qū)(e.g., EDT), 無(wú)法確定時(shí)區(qū)則為空
1: 查看date命令幫助信息
1 [root@Gin scripts]# date --help 2 Usage: date [OPTION]... [+FORMAT] 3 or: date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]] 4 Display the current time in the given FORMAT, or set the system date. 5 6 -d, --date=STRING display time described by STRING, not `now' 7 -f, --file=DATEFILE like --date once for each line of DATEFILE 8 -r, --reference=FILE display the last modification time of FILE 9 -R, --rfc-2822 output date and time in RFC 2822 format. 10 Example: Mon, 07 Aug 2006 12:34:56 -0600 11 --rfc-3339=TIMESPEC output date and time in RFC 3339 format. 12 TIMESPEC=`date', `seconds', or `ns' for 13 date and time to the indicated precision. 14 Date and time components are separated by 15 a single space: 2006-08-07 12:34:56-06:00 16 -s, --set=STRING set time described by STRING 17 -u, --utc, --universal print or set Coordinated Universal Time 18 --help display this help and exit 19 --version output version information and exit 20 21 FORMAT controls the output. Interpreted sequences are: 22 23 %% a literal % 24 %a locale's abbreviated weekday name (e.g., Sun) 25 %A locale's full weekday name (e.g., Sunday) 26 %b locale's abbreviated month name (e.g., Jan) 27 %B locale's full month name (e.g., January) 28 %c locale's date and time (e.g., Thu Mar 3 23:05:25 2005) 29 %C century; like %Y, except omit last two digits (e.g., 20) 30 %d day of month (e.g, 01) 31 %D date; same as %m/%d/%y 32 %e day of month, space padded; same as %_d 33 %F full date; same as %Y-%m-%d 34 %g last two digits of year of ISO week number (see %G) 35 %G year of ISO week number (see %V); normally useful only with %V 36 %h same as %b 37 %H hour (00..23) 38 %I hour (01..12) 39 %j day of year (001..366) 40 %k hour ( 0..23) 41 %l hour ( 1..12) 42 %m month (01..12) 43 %M minute (00..59) 44 %n a newline 45 %N nanoseconds (000000000..999999999) 46 %p locale's equivalent of either AM or PM; blank if not known 47 %P like %p, but lower case 48 %r locale's 12-hour clock time (e.g., 11:11:04 PM) 49 %R 24-hour hour and minute; same as %H:%M 50 %s seconds since 1970-01-01 00:00:00 UTC 51 %S second (00..60) 52 %t a tab 53 %T time; same as %H:%M:%S 54 %u day of week (1..7); 1 is Monday 55 %U week number of year, with Sunday as first day of week (00..53) 56 %V ISO week number, with Monday as first day of week (01..53) 57 %w day of week (0..6); 0 is Sunday 58 %W week number of year, with Monday as first day of week (00..53) 59 %x locale's date representation (e.g., 12/31/99) 60 %X locale's time representation (e.g., 23:13:48) 61 %y last two digits of year (00..99) 62 %Y year 63 %z +hhmm numeric timezone (e.g., -0400) 64 %:z +hh:mm numeric timezone (e.g., -04:00) 65 %::z +hh:mm:ss numeric time zone (e.g., -04:00:00) 66 %:::z numeric time zone with : to necessary precision (e.g., -04, +05:30) 67 %Z alphabetic time zone abbreviation (e.g., EDT) 68 69 By default, date pads numeric fields with zeroes. 70 The following optional flags may follow `%': 71 72 - (hyphen) do not pad the field 73 _ (underscore) pad with spaces 74 0 (zero) pad with zeros 75 ^ use upper case if possible 76 # use opposite case if possible 77 78 After any flags comes an optional field width, as a decimal number; 79 then an optional modifier, which is either 80 E to use the locale's alternate representations if available, or 81 O to use the locale's alternate numeric symbols if available. 82 83 Report date bugs to bug-coreutils@gnu.org 84 GNU coreutils home page: <http://www.gnu.org/software/coreutils/> 85 General help using GNU software: <http://www.gnu.org/gethelp/> 86 For complete documentation, run: info coreutils 'date invocation'