var Time = new Date((that.baseData.data.time) * 1000) //获取时间 that.baseData.data.time 是后端传过来的时间戳例如一串这个玩意:231654654 *1000是因为需要解决产生1970问题
Y = Time.getFullYear() + ‘-‘;
M = (Time.getMonth() + 1 < 10 ? ‘0’ + (Time.getMonth() + 1) : Time.getMonth() + 1) + ‘-‘;
D = Time.getDate() + ‘ ‘;
h = Time.getHours() + ‘:’;
m = Time.getMinutes() + ‘:’;
s = Time.getSeconds();
that.baseDataTime = Y + M + D + h + m + s
console.log(that.baseDataTime);
原创文章,作者:254126420,如若转载,请注明出处:https://blog.ytso.com/245651.html