zoukankan      html  css  js  c++  java
  • Linux-日期时间相关命令

    获取当前时间 date

    1 [root@VM_0_3_centos ~]# date
    2 Mon Mar 18 19:13:33 CST 2019
    3 [root@VM_0_3_centos ~]# 

    date相关选项;

     1 [root@VM_0_3_centos ~]# 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

    这是date在Linux系统中部分帮助信息显示的内容。其中%F%T%Y%m%d%H%M%S%s:是我们比较常用的,详细见下图所示

    示例

    1 [root@VM_0_3_centos ~]# date +%Y%m%d%H%M%S
    2 20190319195335
    3 [root@VM_0_3_centos ~]# 
  • 相关阅读:
    Android程序对不同手机屏幕分辨率自适应的方法
    用户管理和身份验证
    vue----scoped独立样式作用域
    vue----component动态组件
    css----行内元素&&块状元素
    html----rem结合vw布局
    js----jsonp原理
    js----白屏事件&&dom ready时间
    js----var a=b=2解析
    js----常见的表示false的有哪些
  • 原文地址:https://www.cnblogs.com/061713xlhj/p/10554266.html
Copyright © 2011-2022 走看看