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 ~]# 

 

转载于:https://www.cnblogs.com/061713xlhj/p/10554266.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值