1.时间搓转为时间
//时间鹾转换
formatDate(time,num) {
var datetime = "";
if (time == "") {
return false;
}else{
var d = new Date();
d.setTime(time * 1000);
var year = d.getFullYear();
var month = d.getMonth() + 1;
var day = d.getDate();
var minute = d.getMinutes();
var hour = d.getHours();
var second = d.getSeconds();
if(month < 10){
month = "0"+month;
}
if(day < 10){
day = "0"+day;
}
if(hour < 10){
hour = "0"+hour;
}
if(minute < 10){
minute = "0"+minute;
}
if(second < 10){
second = "0"+second;
}
if (num == 0) {
datetime = year + '-' + month +'-'+ day ;
}
else if (num == 2){
datetime = month +'月'+ day+'日';
}else{
datetime = year + '-' + month +'-'+ day +" "+ hour +":"+ minute +":"+ second;
}
return datetime;
}
},