//<editor-fold desc="php时间转换 phpstr:要转的时间戳, typ:输出的类型">
function to_date_time(phpstr, type) {
// console.log(phpstr);
str = parseInt(phpstr) * 1000;//将php时间戳转化为整形并乘以1000
var newDate = new Date(str);
var year = newDate.getUTCFullYear();//取年份
var month = newDate.getUTCMonth() + 1;//取月份
var nowday = newDate.getUTCDate() + 1;//取天数
var hours = newDate.getHours();//取小时
var minutes = newDate.getMinutes();//取分钟
var seconds = newDate.getSeconds();//取秒
// console.log(year + "-" + month + "-" + nowday + " " + hours + ":" + minutes + ":" + seconds);
if (type == "1") {
return year + "." + month + "." + nowday //拼接 2017-2-21
} else {
return year + "-" + month + "-" + nowday + " " + hours + ":" + minutes + ":" + seconds;//拼接 2017-2-21 12:23:43
}
}
//</editor-fold>