一:unix时间戳转普通时间:
var unixtime=1358932051; var unixTimestamp = new Date(unixtime* 1000); commonTime = unixTimestamp.toLocaleString(); alert("普通时间为:"+commonTime);
二:普通时间转化成时间戳
var str ="2013-01-01 00:00:00"; str = str.replace(/-/g,"/"); var date = new Date(str); var humanDate = new Date(Date.UTC(date.getFullYear(),date.getMonth(),date.getDate(),date.getHours(),date.getMinutes(), date.getSeconds())); alert(humanDate.getTime()/1000 - 8*60*60);
时间: 2024-10-06 10:36:14