Javascript toISOString Format
Javascript toISOString Format
JS中的.toISOString()
函数给我这样的字符串:
2015-06-14T20:00:00:000Z
我需要它是这样的:
2015-06-14T20:00:00Z
在JS中是否有其他函数以该格式返回日期?还是我需要自己写一个函数?
谢谢!
没有内置的JavaScript方法以这种格式返回日期。你可以自己写函数,也可以使用momentjs格式。
moment().format("YYYY-MM-DDTHH:mm:ss[Z]")
谢谢你。
我用moment.js。我发现format()
函数实际上是按我想要的方式打印的。
相关文章:
- 使用.format在一些HTML代码中插入文本,会出现错误(Python)
- Format for Excel VBA addWatermarkFromText
- "responsed_to|format|“;引发UnknownFormat错误
- 如何将参数应用于String.prototype.format函数
- momentjs toISOString without the "z"
- XSLTJavascript扩展无法调用Date().toISOString()
- 如何使用Y.Number.format和decimalPlaces
- Javascript toISOString在Golang中的时间
- TypeError:format.match不是矩angularJS中的函数
- String.Format在TypeScript中不起作用
- YQL 返回 application/javascript,即使请求 format=json
- jQuery format date min & max date jQuery UI
- OpenLayers 3.13v: issue with ol.format.GeoJSON()
- Rails 4 ActionController::UnknownFormat format.js error
- toLocaleDateString() short format
- 使用string.format,最佳方法和替代方案在服务器端创建javascript函数
- 尝试使用 d3.time.format 格式化日期时,我收到 JavaScript 错误“d.getMonth 不是一个
- javascript toISOString() 忽略时区偏移量
- MomentJS:为什么format()和toISOString()会产生不同的结果
- Javascript toISOString Format