【微信小程序】把时间戳转换成年-月-日格式

今天工做中要实现把后端传来的时间戳转换成年-月-日格式显示

getDate: function (timestamp){
后端

let date = new Date(timestamp * 1000);
code

console.log(date);//Date 2019-10-17T16:30:00.000Z
get

let year = date.getFullYear();
io

let month = date.getMonth() + 1;
console

let day = date.getDate();
function

return year+"-"+month+"-"+day;
date

},im

记录工做平常遇到的问题,今天也是充实的一天!时间戳

相关文章
相关标签/搜索