时间戳的处理
1.获取时间戳
var timestamp=new Date().getTime();
2.转时间戳
nian='';
yue='';
ri='';
shi='';
fen='';
miao='';
Date.prototype.toLocaleString = function() {
if(this.getFullYear()>9){
nian=this.getFullYear()
}else {
nian='0'+this.getFullYear()
}
if(parseInt(this.getMonth())+1>9){
yue=parseInt(this.getMonth())+parseInt(1)
}else {
yue='0'+(parseInt(this.getMonth())+parseInt(1))
}
if(this.getDate()>9){
ri=this.getDate()
}else {
ri='0'+this.getDate()
}
return nian+'/'+yue+'/'+ri
}
Date.prototype.toLocaleString1 = function() {
if(this.getHours()>9){
shi=this.getHours()
}else {
shi='0'+this.getHours()
}
if(this.getMinutes()>9){
fen=this.getMinutes()
}else {
fen='0'+this.getMinutes()
}
if(this.getSeconds()>9){
miao=this.getSeconds()
}else {
miao='0'+this.getSeconds()
}
return shi+':'+fen+':'+miao
}
输出:new Date(时间戳*1000).toLocaleString()+" "+ new Date(时间戳*1000).toLocaleString1()