传入时间戳导出当前时间函数
function toDateDetail(number) { if (!number) number = new Date(); // var n = number * 1000 var date = new Date(number); var Y = date.getFullYear() + "-"; var M = (date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1) + "-"; var D = date.getDate() < 10 ? "0" + date.getDate() : date.getDate(); var h = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(); var mm = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(); var s = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds(); return Y + "" + M + "" + D + " " + h + ":" + mm + ":" + s; }
向函数直接传时间戳的话 将导出
如果只是调用不传时间戳 就是获取当前的事件