Public processing timestamp function
/**
* Process the timestamp into date format
* @param {Object} obj timestamp {10-digit timestamp needs to be multiplied by 1000; 13-digit timestamp does not need to}
* @return {TypeName } Return date format 2013-09-16
* /
function fullnum(obj){
if(Number(obj) < 10){
return '0' obj;
}else{
return obj;
}
}
1. The timestamp stored in PHP is 10 digits, but when processed by javascript, it needs to be multiplied by 1000 to get the time in date format
var mystime = newDate(msg.pager.result[i].adsdate * 1000 );
var addstime = mystime.getFullYear() '-' fullnum(Number(mystime.getMonth()) 1) '-' fullnum(mystime.getDate());
//The time displayed by addstime is 2013-09-16
2. The timestamp stored in java is 13 digits, so you can get the time in date format 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());
//You can get it directly by using addstime 2013-09-16