后台传回的时间带 T

今天写一个展示页面,需要展示用户充值时间。但是拿到后台数据发现是这个样子的。
在这里插入图片描述

带了一个字母T,这就让我很尴尬了。

解决方式,把这个T替换掉就可以了。

var dateee = new Date(“2017-07-09T09:46:49.667”).toJSON();
var date = new Date(+new Date(dateee)+836001000).toISOString().replace(/T/g,’ ‘).replace(/.[\d]{3}Z/,’’)
alert(date)

感谢分享https://blog.csdn.net/Bright2017/article/details/77480694

猜你喜欢

转载自blog.csdn.net/qq_32963841/article/details/84654738
T