我想知道如果下面的日期是符合ISO8601:在ISO 8601的日期中,T字符是強制性的嗎?
2012-03-02 14:57:05.456+0500
(肯定,2012-03-02T14:57:05.456 + 0500兼容,但沒有那麼多人類可讀!) 督察,是日期和時間之間的T是強制性的?
我想知道如果下面的日期是符合ISO8601:在ISO 8601的日期中,T字符是強制性的嗎?
2012-03-02 14:57:05.456+0500
(肯定,2012-03-02T14:57:05.456 + 0500兼容,但沒有那麼多人類可讀!) 督察,是日期和時間之間的T是強制性的?
除非「信息交換夥伴」同意忽略它,否則這是必需的。
引述ISO 8601 standard,部分4.3.2:
字符[T]應作爲時間標誌,以指示 開始的天組分在這些 表達式的時間表示的。 [...]
注意通過在信息交換的合作伙伴共同協議, 字符[T]可應用可以省略哪裏有混亂的日子表示與他人 的日期和時間沒有 風險定義在這個國際標準中。
忽略它是相當普遍的,但如果表示法是機器可讀的,而且您沒有明確的協議可以省略它,那麼將其保留是可取的。
該日期不ISO-8601標準的基思·湯普森表示,但它是符合RFC 3339,ISO 8601 排序的輪廓。見注:在下面的文本底部從RFC 3339:
date-time = full-date "T" full-time
NOTE: Per [ABNF] and ISO8601, the "T" and "Z" characters in this
syntax may alternatively be lower case "t" or "z" respectively.
This date/time format may be used in some environments or contexts
that distinguish between the upper- and lower-case letters 'A'-'Z'
and 'a'-'z' (e.g. XML). Specifications that use this format in
such environments MAY further limit the date/time syntax so that
the letters 'T' and 'Z' used in the date/time syntax must always
be upper case. Applications that generate this format SHOULD use
upper case letters.
NOTE: ISO 8601 defines date and time separated by "T".
Applications using this syntax may choose, for the sake of
readability, to specify a full-date and full-time separated by
(say) a space character.
我剛剛發現新的日期(「2012-03-02T14:57:05」)在JavaScript將根據時區調整時間,而新的日期(「2012-03-02T14:57:05」)不會調整時間。 – code4j 2015-02-05 06:49:24
@ code4j:我錯過了什麼,還是那些相同? – 2015-02-05 07:36:25
我的天啊。我忘了刪除T字母。它應該是: 新日期(「2012-03-02T14:57:05」):根據時區調整時間,而新日期(「2012-03-02 14:57:05」)將不會調整時間 – code4j 2015-02-05 07:45:01