JavaScript:哪些浏览器支持使用 Date.parse 解析 ISO-8601 日期字符串 [英] JavaScript: Which browsers support parsing of ISO-8601 Date String with Date.parse
本文介绍了JavaScript:哪些浏览器支持使用 Date.parse 解析 ISO-8601 日期字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法在 IE8 和 Safari 5 上解析 ISO-8601 日期2011-04-26T13:16:50Z",但它适用于 Chrome 10、FF4.支持似乎很复杂?
I failed to parse an ISO-8601 date "2011-04-26T13:16:50Z" on IE8 and Safari 5, but it worked on Chrome 10, FF4. Support seems to be quite mixed?
有谁知道哪些浏览器可以解析这种格式的实际状态?我假设 IE6 和 7 也会失败.
Does anyone know the actual status of which browsers can parse this format? I assume IE6, and 7 will fail too.
var d = Date.parse("2011-04-26T13:16:50Z");
推荐答案
我今天遇到了这个问题.我发现 momentjs 是一种跨浏览器解析 ISO 8601 日期的好方法.
I had this issue today. I found momentjs was a good way of parsing ISO 8601 dates in a cross browser manor.
momentjs 也可用于以不同格式输出日期.
momentjs can also be used to output the date in a different format.
这篇关于JavaScript:哪些浏览器支持使用 Date.parse 解析 ISO-8601 日期字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文