js中:
Date.prototype.toLocaleString = function() {
//月
var moth=(this.getMonth() + 1);
//日
var date=this.getDate();
//小时
var hours=this.getHours();
//分
var minutes=this.getMinutes();
//秒
var sconds=this.getSeconds()
if(moth>=1&&moth<=9){
moth="0"+moth;
}
if(date>=0&&date<=9){
date="0"+date;
}
if(hours>=0&&hours<=9){
hours="0"+hours;
}
if(minutes>=0&&minutes<=9){
minutes="0"+minutes;
}
if(sconds>=0&&sconds<=9){
sconds="0"+sconds;
}
return this.getFullYear() + "-" +moth+ "-" +date+ " " +hours+ ":" +minutes+ ":" +sconds;
};
var unixTimestamp = new Date(checkOutMessage.checkintime) ;
commonTime = unixTimestamp.toLocaleString();
alert(commonTime);