1. [代码] [JavaScript]代码 //将时间戳转换为时间格式//time为要转换的时间戳function getLocalMinute(time) { var now = new Date(time*1000);var year=now.getFullYear(); var month=now.getMonth()+1; var date=now.getDate(); va
1. [代码][JavaScript]代码
//将时间戳转换为时间格式 //time为要转换的时间戳 function getLocalMinute(time) { var now = new Date(time*1000); var year=now.getFullYear(); var month=now.getMonth()+1; var date=now.getDate(); var hour=now.getHours(); var minute=now.getMinutes()<10 ?'0'+now.getMinutes():now.getMinutes(); var second=now.getSeconds(); return year+"-"+month+"-"+date+" " + hour + ':' + minute; } //将时间格式转换为时间戳 function getLocalData(time){ if (time == ""){ return ""; }else { var str = time.replace(/-/g,'/'); var data = new Date(str) return parseInt(data.getTime())/1000 + 60*60*24; } }