function getTimeFormatByType(time,type){
if(!time)return;
var date;
if(typeof(time)=='string'){
if(time.indexOf("T")>0){
date=new Date(time.substring(0,10) + 'T' + time.substring(11));
}else{
date=justep.Date.fromString(time, 'yyyy-MM-dd hh:mm:ss');
}
}else{
date=new Date(time);
}
var year=date.getFullYear(); //获取系统的年;
var mouth=date.getMonth()+1;
var today=date.getDate();
var hours=date.getHours();
var minutes= date.getMinutes();
var Seconds=date.getSeconds(); //秒
if(mouth<=9) mouth = "0"+mouth;
if(hours<=9) hours = "0"+hours;
if(today <= 9) today = "0"+today;
if(minutes <= 9) minutes = "0"+minutes;
if(Seconds <= 9) Seconds = "0"+Seconds;
if(type==1){//2017-08-07 10:53:55
return year+"-"+mouth+"-"+today+" "+hours+":"+minutes+":"+Seconds;
}
if(type==2){//08-07 10:53
return mouth+"-"+today+" "+hours+":"+minutes;
}
if(type==3){//2017-08-07
return year+"-"+mouth+"-"+today;
}
if(type==4){// 10:53
return hours+":"+minutes;
}
if(type==5){// 08-07
return mouth+"-"+today;
}
}
if(!time)return;
var date;
if(typeof(time)=='string'){
if(time.indexOf("T")>0){
date=new Date(time.substring(0,10) + 'T' + time.substring(11));
}else{
date=justep.Date.fromString(time, 'yyyy-MM-dd hh:mm:ss');
}
}else{
date=new Date(time);
}
var year=date.getFullYear(); //获取系统的年;
var mouth=date.getMonth()+1;
var today=date.getDate();
var hours=date.getHours();
var minutes= date.getMinutes();
var Seconds=date.getSeconds(); //秒
if(mouth<=9) mouth = "0"+mouth;
if(hours<=9) hours = "0"+hours;
if(today <= 9) today = "0"+today;
if(minutes <= 9) minutes = "0"+minutes;
if(Seconds <= 9) Seconds = "0"+Seconds;
if(type==1){//2017-08-07 10:53:55
return year+"-"+mouth+"-"+today+" "+hours+":"+minutes+":"+Seconds;
}
if(type==2){//08-07 10:53
return mouth+"-"+today+" "+hours+":"+minutes;
}
if(type==3){//2017-08-07
return year+"-"+mouth+"-"+today;
}
if(type==4){// 10:53
return hours+":"+minutes;
}
if(type==5){// 08-07
return mouth+"-"+today;
}
}