ISO 8601和RFC 3339日期格式有什么区别? [英] What's the difference between ISO 8601 and RFC 3339 Date Formats?

查看:513
本文介绍了ISO 8601和RFC 3339日期格式有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ISO 8601 RFC 3339 似乎是两种常见的格式。我应该用另外一个吗?只是一个扩展?我真的需要关心这个不好吗?

解决方案


只是一个扩展? >

很多,是 - RFC 3339被列为ISO 8601的配置文件。最值得注意的是RFC 3339需要一个完整的表示的日期和时间(只有小数秒是可选的)。 RFC也有一些小小的微妙差异。例如,仅允许两位数的截断表示年龄是不允许的 - RFC 3339需要4位数字的年份,RFC只允许将句点字符用作小数点的小数秒。 RFC还允许将T替换为空格(或其他字符),而标准仅允许将其忽略(仅当所有使用该表示的各方达成一致时)。



我不会太担心两者之间的差异,但是对于您的使用案例,您的使用情况可能会让您失望,您可以瞥一下: / p>


ISO 8601 and RFC 3339 seem to be two formats that are common the web. Should I use one over the other? Is one just an extension? Do I really need to care that bad?

解决方案

Is one just an extension?

Pretty much, yes - RFC 3339 is listed as a profile of ISO 8601. Most notably RFC 3339 requires a complete representation of date and time (only fractional seconds are optional). The RFC also has some small, subtle differences. For example truncated representations of years with only two digits are not allowed -- RFC 3339 requires 4-digit years, and the RFC only allows a period character to be used as the decimal point for fractional seconds. The RFC also allows the "T" to be replaced by a space (or other character), while the standard only allows it to be omitted (and only when there is agreement between all parties using the representation).

I wouldn't worry too much about the differences between the two, but on the off-chance your use case runs in to them, it'd be worth your while taking a glance at:

这篇关于ISO 8601和RFC 3339日期格式有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆