java获取时间 t00:00:00.0z,这种格式是什么意思T00:00:00.000Z?

编程入门 行业动态 更新时间:2024-10-05 23:18:21

java获取时间 t00:00:00.0z,这种<a href=https://www.elefans.com/category/jswz/34/1771175.html style=格式是什么意思T00:00:00.000Z?"/>

java获取时间 t00:00:00.0z,这种格式是什么意思T00:00:00.000Z?

Please someone explain this type of format in javascript

T00:00:00.000Z

And how to parse it.

Thanks

解决方案

It's a part of ISO-8601 date representation. It's incomplete because a complete date representation in this pattern should also contains the date:

2015-03-04T00:00:00.000Z //Complete ISO-8601 date

If you try to parse this date as it is you will receive an Invalid Date error:

new Date('T00:00:00.000Z'); // Invalid Date

So, I guess the way to parse a timestamp in this format is to concat with any date

new Date('2015-03-04T00:00:00.000Z'); // Valid Date

Then you can extract only the part you want (timestamp part)

var d = new Date('2015-03-04T00:00:00.000Z');

console.log(d.getUTCHours()); // Hours

console.log(d.getUTCMinutes());

console.log(d.getUTCSeconds());

更多推荐

java获取时间 t00:00:00.0z,这种格式是什么意思T00:00:00.000Z?

本文发布于:2024-02-28 08:13:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1768846.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:格式   时间   java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!