一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務器之家:專注于服務器技術及軟件下載分享
分類導航

Linux|Centos|Ubuntu|系統進程|Fedora|注冊表|Bios|Solaris|Windows7|Windows10|Windows11|windows server|

服務器之家 - 服務器系統 - Linux - Linux命令之日期時間命令date使用實例

Linux命令之日期時間命令date使用實例

2019-09-19 18:15服務器之家 Linux

這篇文章主要介紹了Linux命令之日期時間命令date使用實例,本文著重講解了它的格式化參數,同時講解了使用語法和使用實例,需要的朋友可以參考下

date用法1:

       格式:date [OPTION]... [+FORMAT]

       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     locale's date and time (e.g., Thu Mar  3 23:05:25 2005)

       %C     century; like %Y, except omit last two digits (e.g., 20)

       %d     day of month (e.g., 01)

       %D     date; same as %m/%d/%y

       %e     day of month, space padded; same as %_d

       %F     full date; same as %Y-%m-%d

       %g     last two digits of year of ISO week number (see %G)

       %G     year of ISO week number (see %V); normally useful only with %V

       %h     same as %b


       %H     hour (00..23)

       %I     hour (01..12)

       %j     day of year (001..366)

       %k     hour, space padded ( 0..23); same as %_H


       %l     hour, space padded ( 1..12); same as %_I


       %m     month (01..12)


       %M     minute (00..59)


       %n     a newline


       %N     nanoseconds (000000000..999999999)


       %p     locale's equivalent of either AM or PM; blank if not known


       %P     like %p, but lower case


       %r     locale's 12-hour clock time (e.g., 11:11:04 PM)


       %R     24-hour hour and minute; same as %H:%M


       %s     seconds since 1970-01-01 00:00:00 UTC


       %S     second (00..60)


       %t     a tab


       %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 week (00..53)


       %V     ISO week number, with Monday as first day of week (01..53)


       %w     day of week (0..6); 0 is Sunday

 

       %W     week number of year, with Monday as first day of week (00..53)


       %x     locale's date representation (e.g., 12/31/99)


       %X     locale's time representation (e.g., 23:13:48)


       %y     last two digits of year (00..99)


       %Y     year


       %z     +hhmm numeric time zone (e.g., -0400)


       %:z    +hh:mm numeric time zone (e.g., -04:00)


       %::z   +hh:mm:ss numeric time zone (e.g., -04:00:00)


       %:::z  numeric time zone with : to necessary precision (e.g., -04, +05:30)


       %Z     alphabetic time zone abbreviation (e.g., EDT)


       By default, date pads numeric fields with zeroes.  The following optional flags may follow `%':


       -      (hyphen) do not pad the field


       _      (underscore) pad with spaces


       0      (zero) pad with zeros


       ^      use upper case if possible


       #      use opposite case if possible

例如:

1.年月日
 

復制代碼

代碼如下:


$ date +%Y%m%d
20150107


2.年月日,年只保留后兩位

復制代碼

代碼如下:


~$ date +%y%m%d
150107


3.小時分鐘秒

復制代碼

代碼如下:


~$ date +%H%M%S
233045


4.年月日時分秒

復制代碼

代碼如下:


~$ date +%Y%m%d%H%M%S
20150107233145

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 我要看免费毛片 | 国产成人小视频在线观看 | 5151hh四虎国产精品 | 精品无人区麻豆乱码无限制 | 192.168.191 | 视频国产91 | 好吊色永久免费视频大全 | 九九爱这里只有精品 | 91精品国产9l久久久久 | 99国产在线视频 | 小鸟酱视频在线观看 | 久久久久伊人 | 日本在线国产 | 成人永久免费视频 | 国产一级毛片潘金莲的奶头 | 高清视频大片免费观看 | 99操视频 | 驯服有夫之妇HD中字日本 | 精品国产一区二区三区在线观看 | 日韩精品视频观看 | 成年人视频在线播放 | 天堂网站天堂小说 | 午夜影视在线观看 | 91大神在线精品视频一区 | 操女b | 九九国产视频 | daring国家队在线观看樱花动漫 | 国产成人小视频在线观看 | 青青国产成人久久激情911 | freee×xx性欧美| 国产一级特黄aa大片免费 | 182免费在线观看 | 午夜福利视频极品国产83 | 亚洲电影成人 成人影院 | 天天中文| 大学生宿舍飞机china free | 91精品国产人成网站 | 久久国产精品免费网站 | 欧美在线一级片 | 冰雪奇缘1完整版免费观看 变形金刚第一部 | 国产精品乱码高清在线观看 |