实际上我的时间和日期格式如下 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/