【问题标题】:linux date validation difference between ubuntu and centosubuntu和centos之间的linux日期验证区别
【发布时间】:2014-07-23 10:35:40
【问题描述】:

以下适用于我的 Ubuntu 机器

$ 日期-d 2014-07-23T00:00Z

2014 年 7 月 23 日 02:00:00 CEST

在另一台运行 centos 的机器上,我得到了

$ 日期-d 2014-07-23T00:00Z

日期:无效日期`2014-07-23T00:00Z'

从跑步开始

日期--版本

可以看到gnu coreutils的版本在Ubuntu上是8.21,在centos机器上是8.4。

我的问题是:发生这种情况是由于日期功能的差异,还是与其他原因有关(比如我玩过的语言环境,但没有成功)?

如果是由于日期功能的差异,我在哪里可以了解这些更新?

【问题讨论】:

    标签: linux shell date ubuntu


    【解决方案1】:

    来自NEWS file

    * Noteworthy changes in release 8.13 (2011-09-08) [stable]
    
    [..trim..]
    
    ** New features
    
      date now accepts ISO 8601 date-time strings with "T" as the
      separator.  It has long parsed dates like "2004-02-29 16:21:42"
      with a space between the date and time strings.  Now it also parses
      "2004-02-29T16:21:42" and fractional-second and time-zone-annotated
      variants like "2004-02-29T16:21:42.333-07:00"
    

    因此,它是 GNU Coreutils 8.13 及更高版本中提供的一项功能。

    此条目还应该为您提供有关如何修复字符串以使其适用于两个平台的答案:-)

    【讨论】:

    • 感谢您的快速回答。我没有找到那个新闻文件。我尝试了 /usr/share/doc/coreutils 下的更新日志,但没有找到这个金块。
    猜你喜欢
    • 2012-06-12
    • 2021-08-23
    • 2017-06-25
    • 2023-03-29
    • 1970-01-01
    • 2014-01-08
    • 2023-03-29
    • 2020-10-19
    • 2018-01-15
    相关资源
    最近更新 更多