在wxs中进行日期转换,出现的问题
2018-07-05T17:15:01.000Z 转换后变成 Fri Jul 06 2018 01:15:01 GMT+0800 (中国标准时间)
//格式化显示时间
var formatDate = function (d) {
console.log(d);
var date = getDate(d);
console.log(date);
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
console.log(day);
var hour = date.getUTCHours();
var minute = date.getUTCMinutes();
var second = date.getUTCSeconds();
return [year, month, day].map(formatNumber).join(’/’) + ’ ’ + [hour, minute, second].map(formatNumber).join(’:’);
}
var formatNumber = function (n) {
n = n.toString()
return n[1] ? n : ‘0’ + n
}