1、小于10前面补0
function add0(m){
return m<10?'0'+m:m
}
2、转为年-月-日 时:分:秒格式
function timeFormat(ts)
{
var time = new Date(ts);
var y = time.getFullYear();
var m = time.getMonth()+1;
var d = time.getDate();
var h = time.getHours();
var mm = time.getMinutes();
var s = time.getSeconds();
return y+'-'+add0(m)+'-'+add0(d)+' '+add0(h)+':'+add0(mm)+':'+add0(s);
}