function timestampToTime(timestamp) { var date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000 Y = date.getFullYear() + '-'; M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-'; D = date.getDate() + ' '; h =…
TimeNow: function (val) { var date = new Date(val); var Y = date.getFullYear(); var m = date.getMonth() + 1; var d = date.getDate(); var H = date.getHours(); var i = date.getMinutes(); var s = date.getSeconds(); if (m < 10) m = '0' + m; if (d < 10)…
// 判断是否前面补0 add0 (m) { return m < 10 ? '0' + m : m }, // 时间转化 timeFormat (timestamp) { // timestamp是整数,否则要parseInt转换,不会出现少个0的情况 var time = new Date(timestamp) // var year = time.getFullYear() // var month = time.getMonth() + 1 // var date = time.getD…