我想使用 javascript 2014-08-07T22:35:00 + 04:00 此字符串转换为 22:35:00 >
请提供jsfiddle
链接
答案 0 :(得分:2)
http://jsfiddle.net/PeteA/kr11waha/
function addZero(v) {
if (v < 10) return '0' + v;
return v;
}
function stripTime(ds) {
var d = new Date(ds),
h = addZero(d.getHours()),
m = addZero(d.getMinutes()),
s = addZero(d.getSeconds());
return h + ':' + m + ':' + s;
}
document.getElementById('answer').innerHTML = stripTime('2014-08-07T22:35:00+04:00');
这应该是你在纯JS中所做的事情