1
var unixtime=1358932051;
formatTime (time) { 2 let unixtime = time 3 let unixTimestamp = new Date(unixtime * 1000) 4 let Y = unixTimestamp.getFullYear() 5 let M = ((unixTimestamp.getMonth() + 1) > 10 ? (unixTimestamp.getMonth() + 1) : '0' + (unixTimestamp.getMonth() + 1)) 6 let D = (unixTimestamp.getDate() > 10 ? unixTimestamp.getDate() : '0' + unixTimestamp.getDate()) 7 let toDay = Y + '-' + M + '-' + D 8 return toDay 9 }