最佳答案
以下是用 JavaScript 将日期序列化为 ISO 8601字符串的标准方法:
var now = new Date();
console.log( now.toISOString() );
// outputs '2015-12-02T21:45:22.279Z'
我只需要相同的输出,但没有毫秒。如何输出 2015-12-02T21:45:22Z
?