admin管理员组文章数量:1323330
Using Javascript how do I convert ISO string 2013-08-10T12:10:15.474Z into a date ()object. do not use moment
I want to end up with HH MM SS MM DD YYYY
date.parse converts the string into milliseconds since 1/1/70 That is not what I want.
Using Javascript how do I convert ISO string 2013-08-10T12:10:15.474Z into a date ()object. do not use moment
I want to end up with HH MM SS MM DD YYYY
date.parse converts the string into milliseconds since 1/1/70 That is not what I want.
Share edited Nov 3, 2017 at 2:19 Herbie asked Nov 3, 2017 at 1:50 HerbieHerbie 871 gold badge1 silver badge5 bronze badges 5-
1
What happened when you tried
new Date('2013-08-10T12:10:15.474Z')
? OrDate.parse()
? – nnnnnn Commented Nov 3, 2017 at 1:51 -
What about using
Date.parse('2013-08-10T12:10:15.474Z')
? – m00n Commented Nov 3, 2017 at 1:54 - 5 Possible duplicate of Change ISO Date String to Date Object - JavaScript – admcfajn Commented Nov 3, 2017 at 1:57
- 1 Date.parse() does not return a date object... – dandavis Commented Nov 3, 2017 at 2:15
-
Regarding your edit, and the desired output format, if you just need a string in a different format and not a
Date()
object the easiest way is to do it all as string manipulation: a one-liner with the string.replace()
method and a regex. – nnnnnn Commented Nov 3, 2017 at 2:30
1 Answer
Reset to default 6You can use new Date('2013-08-10T12:10:15.474Z')
or Date.parse('2013-08-10T12:10:15.474Z')
.
本文标签: javascriptconvert ISO date time string into a Date() objectStack Overflow
版权声明:本文标题:javascript - convert ISO date time string into a Date() object - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742139790a2422530.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论