date时间加减(linux,aix)

需求是这样的,有一个在日志中的时间,格式化为%Y%m%d-%H%M%S格式的,那现在想比较这个时间与当前时间差值是否大于一天,这个应该怎么做呢?设计到日期的减法运算,首先先man date来看一下用法吧。

DATE(1)                          User Commands                         DATE(1)

NAME
       date - print or set the system date and time
            - 打印或设置系统日期和时间

SYNOPSIS
       date [OPTION]... [+FORMAT]
       date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]

DESCRIPTION
       Display the current time in the given FORMAT, or set the system date.
       以给定的格式显示当前时间,或者设置系统时间。

       -d, --date=STRING
              display time described by STRING, not ‘now’
              显示字符串表示的时间,字符串不能是“now”

       -f, --file=DATEFILE
              like --date once for each line of DATEFILE


       -r, --reference=FILE
              display the last modification time of FILE
              显示文件最近一次修改的时间

       -R, --rfc-2822
              output  date  and time in RFC 2822 format.  Example: Mon, 07 Aug
              2006 12:34:56 -0600
              以RFC格式输出日期和时间,示例:Mon, 07 Aug 2006 12:34:56 -0600

       --rfc-3339=TIMESPEC
              output date and time in RFC 3339 format.  TIMESPEC=‘date’, ‘sec-
              onds’,  or  ‘ns’  for  date and time to the indicated precision.
              Date and time  components  are  separated  by  a  single  space:
              2006-08-07 12:34:
  • 0
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值