【问题标题】:What is the technical term of the time format of this value "20150716203621.000Z"?这个值“20150716203621.000Z”的时间格式的技术术语是什么?
【发布时间】:2015-11-08 04:17:29
【问题描述】:

所以我有一个格式为“20150716203621.000Z”的时间值,我从 LDAP 服务器检索到,但是我不确定这个时间的格式是什么?最终目标是能够将其转换为 Java.Util.Date 对象。有谁知道这种格式的技术术语是什么?谢谢。

【问题讨论】:

标签: java date unix formatting timestamp


【解决方案1】:

它似乎指的是SimpleDateFormat 对象。末尾的Z 指的是时区。见simpledateformat parsing date with 'Z' literal

【讨论】:

    【解决方案2】:

    yyyy-mm-ddT00:00:00.000Z

    所以 20150716203621.000Z 是 2015.07.16。 20:36:21 和 000 是毫秒。

    Z 表示 UTC 时区。

    【讨论】:

      【解决方案3】:

      这是RFC 3339 中指定的标准日期/时间格式,ISO 8601 的配置文件。

      来自 RFC:

        date-fullyear   = 4DIGIT
        date-month      = 2DIGIT  ; 01-12
        date-mday       = 2DIGIT  ; 01-28, 01-29, 01-30, 01-31 based on
                                   ; month/year
        time-hour       = 2DIGIT  ; 00-23
        time-minute     = 2DIGIT  ; 00-59
        time-second     = 2DIGIT  ; 00-58, 00-59, 00-60 based on leap second
                                   ; rules
        time-secfrac    = "." 1*DIGIT
        time-numoffset  = ("+" / "-") time-hour ":" time-minute
        time-offset     = "Z" / time-numoffset
      

      【讨论】:

      • 问题中显示的示例20150716203621.000Z 是这种格式的“基本”版本。扩展版本更易于阅读:2015-07-T16:20:36.21.000Z 使用T 将日期部分与时间部分分开。您可以将T 换成 SPACE 以提高可读性,但不建议用于数据交换。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多