首页 > 代码库 > 时间戳

时间戳

function timestamp(time){
var date = new Date(time); //传个时间戳过去就可以了
Y = date.getFullYear() + ‘-‘;
M = (date.getMonth()+1 < 10 ? ‘0‘+(date.getMonth()+1) : date.getMonth()+1) + ‘-‘;
D = date.getDate() + ‘ ‘;
return Y+M+D; //2014-04-23 18:55:49:123
}

时间戳