時間戳轉換
阿新 • • 發佈:2020-12-25
技術標籤:JS
// //時間戳為10位需*1000,時間戳為13位的話不需乘1000 formatDate(now) { now = new Date(now); var year = now.getFullYear(); var month = now.getMonth() + 1; var date = now.getDate(); // var hour=now.getHours(); // var minute=now.getMinutes(); // var second=now.getSeconds(); return year + "-" + month + "-" + date; },