var d = new Date();
d.setTime(time*1000);
var year=d.getFullYear();
var month=d.getMonth()+1;
month=fillZero(month);
var date=d.getDate();
date=fillZero(date);
var hours=d.getHours();
hours=fillZero(hours);
var minutes=d.getMinutes();
minutes=fillZero(minutes);
var seconds=d.getSeconds();
seconds=fillZero(seconds);
var t = year+'-'+month+'-'+date+' '+hours+':'+minutes+':'+seconds;

function fillZero(n){
return n<10?'0'+n:''+n;
}