gpt4 book ai didi

jquery - 如何在jquery(2015-08-21T12 :35:01. 5588081Z)中将以下内容转换成标准时间格式?

转载 作者:行者123 更新时间:2023-11-28 03:07:05 24 4
gpt4 key购买 nike

实际上我的时间和日期格式如下 2015-08-21T12:35:01.5588081Z 现在我需要的是如何转换这种格式 2015-08-21T12:35 :01.5588081Z 到 jquery 中的这个12:35 08/21/15。提前致谢。

最佳答案

尝试使用带参数 "2015-08-21T12:35:01.5588081Z"new Date() 转换为 Date 对象, .getUTCHours() , .getMinutes() , .getDate() , .getDay() , >.getFullYear() , String.prototype.slice()

var date = "2015-08-21T12:35:01.5588081Z";
var d = new Date(date);
var res = String(d.getUTCHours() + ":" + d.getUTCMinutes() + " ")
.concat(d.getMonth() + 1 + "/")
.concat(d.getDate() + "/")
.concat(d.getFullYear().toString().slice(-2));
document.write(res);

关于jquery - 如何在jquery(2015-08-21T12 :35:01. 5588081Z)中将以下内容转换成标准时间格式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32152421/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com