Javascript handles the method of having a timestamp in date format


Common processing timestamp functions



function fullnum(obj){
if(Number(obj) < 10){
return '0' + obj;
}else{
return obj;
}
}

1. The timestamp stored in PHP is 10 bits, but in javascript processing you need to multiply it by 1000 to get the date format time


var mystime = newDate(msg.pager.result[i].adsdate * 1000);
var addstime = mystime.getFullYear() +'-' + fullnum(Number(mystime.getMonth()) + 1) + '-' + fullnum(mystime.getDate());
//The time addstime displays is 2013-09-16

2. The timestamp stored in Java is 13 bits, so the time in date format can be obtained without any processing in javascript


var mystime = newDate(msg.pager.result[i].adsdate);
var addstime = mystime.getFullYear() +'-' + fullnum(Number(mystime.getMonth()) + 1) + '-' + fullnum(mystime.getDate());
//Simply use addstime to get 2013-09-16